[Xfce4-commits] [apps/ristretto] 01/01: Fix memory leaks in Properties dialog

noreply at xfce.org noreply at xfce.org
Tue Oct 18 16:01:05 CEST 2016


This is an automated email from the git hooks/post-receive script.

f2404 pushed a commit to branch master
in repository apps/ristretto.

commit 9f34f747e011b48db63ea1955264f49c1b8bce28
Author: Igor <f2404 at yandex.ru>
Date:   Tue Oct 18 17:00:58 2016 +0300

    Fix memory leaks in Properties dialog
---
 src/properties_dialog.c | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/src/properties_dialog.c b/src/properties_dialog.c
index 386065f..7ee01b1 100644
--- a/src/properties_dialog.c
+++ b/src/properties_dialog.c
@@ -352,12 +352,18 @@ static void
 rstto_properties_dialog_dispose (GObject *object)
 {
     RsttoPropertiesDialog *dialog = RSTTO_PROPERTIES_DIALOG (object);
-    if (dialog->priv->settings)
+    if (dialog->priv)
     {
-        g_object_unref (dialog->priv->settings);
-        dialog->priv->settings = NULL;
+        if (dialog->priv->settings)
+        {
+            g_object_unref (dialog->priv->settings);
+            dialog->priv->settings = NULL;
+        }
+
+        g_free (dialog->priv);
+        dialog->priv = NULL;
     }
-    
+
     G_OBJECT_CLASS(parent_class)->dispose(object);
 }
 
@@ -428,27 +434,28 @@ properties_dialog_set_file (
 
     if (dialog->priv->file)
     {
-
         file_uri = rstto_file_get_uri (file);
         file_uri_checksum = g_compute_checksum_for_string (G_CHECKSUM_MD5, file_uri, strlen (file_uri));
         filename = g_strconcat (file_uri_checksum, ".png", NULL);
+        g_free (file_uri_checksum);
 
         /* build and check if the thumbnail is in the new location */
         thumbnail_path = g_build_path ("/", g_get_user_cache_dir(), "thumbnails", "normal", filename, NULL);
-
-        if(!g_file_test (thumbnail_path, G_FILE_TEST_EXISTS))
+        if (!g_file_test (thumbnail_path, G_FILE_TEST_EXISTS))
         {
             /* Fallback to old version */
             g_free (thumbnail_path);
 
             thumbnail_path = g_build_path ("/", g_get_home_dir(), ".thumbnails", "normal", filename, NULL);
-            if(!g_file_test (thumbnail_path, G_FILE_TEST_EXISTS))
+            if (!g_file_test (thumbnail_path, G_FILE_TEST_EXISTS))
             {
                 /* Thumbnail doesn't exist in either spot */
                 g_free (thumbnail_path);
                 thumbnail_path = NULL;
             }
         }
+        g_free (filename);
+
         pixbuf = gdk_pixbuf_new_from_file_at_scale (thumbnail_path, 96, 96, TRUE, NULL);
         if (NULL != pixbuf)
         {
@@ -613,6 +620,10 @@ properties_dialog_set_file (
                         GTK_SHRINK,
                         4,
                         4);
+                if (NULL != label_string)
+                {
+                    g_free (label_string);
+                }
             }
 
             gtk_widget_show_all (dialog->priv->image_table);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list