[gnome-control-center/gnome-3-14] background: Fix a few memory leaks



commit 215f1b87ec0849b0f8436e6d5e9d84849efcb983
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Oct 27 14:35:42 2015 +0100

    background: Fix a few memory leaks
    
    https://bugzilla.gnome.org/show_bug.cgi?id=757189

 panels/background/bg-pictures-source.c  |    1 +
 panels/background/cc-background-panel.c |    4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/panels/background/bg-pictures-source.c b/panels/background/bg-pictures-source.c
index 1dcce19..d02045f 100644
--- a/panels/background/bg-pictures-source.c
+++ b/panels/background/bg-pictures-source.c
@@ -954,6 +954,7 @@ bg_pictures_source_init (BgPicturesSource *self)
                                    G_FILE_QUERY_INFO_NONE,
                                    G_PRIORITY_LOW, priv->cancellable,
                                    dir_enum_async_ready, self);
+  g_free (cache_path);
 
   priv->cache_dir_monitor = g_file_monitor_directory (dir,
                                                       G_FILE_MONITOR_NONE,
diff --git a/panels/background/cc-background-panel.c b/panels/background/cc-background-panel.c
index 52366d2..50369a8 100644
--- a/panels/background/cc-background-panel.c
+++ b/panels/background/cc-background-panel.c
@@ -289,6 +289,7 @@ on_screenshot_finished (GObject *source,
   if (result == NULL) {
     if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
       g_error_free (error);
+      g_free (data);
       return;
     }
     g_debug ("Unable to get screenshot: %s",
@@ -338,8 +339,6 @@ on_screenshot_finished (GObject *source,
                                                                  data->monitor_rect.width,
                                                                  data->monitor_rect.height);
 
-  g_free (data);
-
   /* remove the temporary file created by the shell */
   g_unlink (panel->priv->screenshot_path);
   g_clear_pointer (&priv->screenshot_path, g_free);
@@ -349,6 +348,7 @@ on_screenshot_finished (GObject *source,
 
  out:
   update_display_preview (panel, WID ("background-desktop-drawingarea"), priv->current_background);
+  g_free (data);
 }
 
 static gboolean


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