[eog-plugins] postr: Fix memory leak



commit 11759303af4725b33feecc5c0570dda688059704
Author: Felix Riemann <friemann gnome org>
Date:   Sun Feb 15 17:55:04 2015 +0100

    postr: Fix memory leak

 plugins/postr/eog-postr-plugin.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/plugins/postr/eog-postr-plugin.c b/plugins/postr/eog-postr-plugin.c
index cf25485..a42b345 100644
--- a/plugins/postr/eog-postr-plugin.c
+++ b/plugins/postr/eog-postr-plugin.c
@@ -50,18 +50,24 @@ postr_cb (GSimpleAction *simple,
                EogImage *image = (EogImage *) i->data;
                GFile *imgfile;
                gchar *imgpath;
+               gchar *oldcmd = cmd;
 
                imgfile = eog_image_get_file (image);
                imgpath = g_file_get_path (imgfile);
 
-               if (G_LIKELY (imgpath != NULL))
-                       cmd = g_strconcat (cmd, "\"", imgpath, "\"", " ", NULL);
+               if (G_LIKELY (imgpath != NULL)) {
+                       cmd = g_strconcat (oldcmd, "\"", imgpath, "\"", " ", NULL);
+                       g_free (oldcmd);
+               }
 
                g_free (imgpath);
                g_object_unref (imgfile);
        }
 
        g_spawn_command_line_async (cmd, NULL);
+
+       g_list_free_full (images, g_object_unref);
+       g_free (cmd);
 }
 
 


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