[gimp] app: fix 2 possible leaks.



commit a10bb056ed4aa7570a5400427584853810df0a81
Author: Jehan <jehan girinstud io>
Date:   Sat Aug 14 19:57:00 2021 +0200

    app: fix 2 possible leaks.
    
    In some cases, the `src_viewables` and `drop_path` variables may leak.
    Thanks to Massimo for the report on `src_viewables`!

 app/widgets/gimpcontainertreeview-dnd.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/app/widgets/gimpcontainertreeview-dnd.c b/app/widgets/gimpcontainertreeview-dnd.c
index d9dd488195..81123f8165 100644
--- a/app/widgets/gimpcontainertreeview-dnd.c
+++ b/app/widgets/gimpcontainertreeview-dnd.c
@@ -225,7 +225,6 @@ gimp_container_tree_view_drop_status (GimpContainerTreeView    *tree_view,
             {
               g_warning ("%s: contents of the viewable list has the wrong type '%s'.",
                          G_STRFUNC, G_OBJECT_TYPE_NAME (iter->data));
-              g_list_free (src_viewables);
               goto drop_impossible;
             }
       }
@@ -336,6 +335,10 @@ gimp_container_tree_view_drop_status (GimpContainerTreeView    *tree_view,
                                                      tree_view);
               *return_src = src_viewables;
             }
+          else
+            {
+              g_list_free (src_viewables);
+            }
 
           if (return_dest)
             *return_dest = dest_viewable;
@@ -345,12 +348,12 @@ gimp_container_tree_view_drop_status (GimpContainerTreeView    *tree_view,
 
           return TRUE;
         }
-
-      gtk_tree_path_free (drop_path);
     }
 
  drop_impossible:
 
+  g_list_free (src_viewables);
+  gtk_tree_path_free (drop_path);
   gdk_drag_status (context, 0, time);
 
   return FALSE;


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