[gnome-builder] Fix a couple memory leaks



commit c4270d31b206b5a8b205278e4e1856a283954867
Author: Matthew Leeds <mleeds redhat com>
Date:   Fri Jan 20 00:11:52 2017 -0600

    Fix a couple memory leaks
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777521

 libide/history/ide-back-forward-list.c    |    2 +-
 plugins/mingw/ide-mingw-device-provider.c |   10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/libide/history/ide-back-forward-list.c b/libide/history/ide-back-forward-list.c
index 8f6ae74..978fee2 100644
--- a/libide/history/ide-back-forward-list.c
+++ b/libide/history/ide-back-forward-list.c
@@ -313,7 +313,7 @@ ide_back_forward_list_merge (IdeBackForwardList *self,
   g_assert (ar2 != NULL);
 
   if (ar2->len == 0)
-    return;
+    goto cleanup;
 
   first = g_ptr_array_index (ar2, 0);
 
diff --git a/plugins/mingw/ide-mingw-device-provider.c b/plugins/mingw/ide-mingw-device-provider.c
index 297d74f..d0bc53a 100644
--- a/plugins/mingw/ide-mingw-device-provider.c
+++ b/plugins/mingw/ide-mingw-device-provider.c
@@ -159,6 +159,15 @@ ide_mingw_device_provider_constructed (GObject *object)
   task = g_task_new (self, NULL, load_cb, NULL);
   g_task_run_in_thread (task, ide_mingw_device_provider_discover_worker);
 }
+static void
+ide_mingw_device_provider_finalize (GObject *object)
+{
+  IdeMingwDeviceProvider *self = (IdeMingwDeviceProvider *)object;
+
+  g_clear_pointer (&self->devices, g_ptr_array_unref);
+
+  G_OBJECT_CLASS (ide_mingw_device_provider_parent_class)->finalize (object);
+}
 
 static void
 ide_mingw_device_provider_get_property (GObject    *object,
@@ -185,6 +194,7 @@ ide_mingw_device_provider_class_init (IdeMingwDeviceProviderClass *klass)
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
   object_class->constructed = ide_mingw_device_provider_constructed;
+  object_class->finalize = ide_mingw_device_provider_finalize;
   object_class->get_property = ide_mingw_device_provider_get_property;
 
   properties [PROP_SETTLED] =


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]