[glade/tintou/gwactionclass-leak: 2/2] gladeui: fix memory leak in GWActionClass



commit e7f0a4d17ac3bee6e7b7801ddffd98e4f6fea37b
Author: Corentin Noël <corentin noel collabora com>
Date:   Mon Apr 1 10:59:12 2019 +0200

    gladeui: fix memory leak in GWActionClass

 gladeui/glade-widget-action.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/gladeui/glade-widget-action.c b/gladeui/glade-widget-action.c
index 0484345c..8535bc61 100644
--- a/gladeui/glade-widget-action.c
+++ b/gladeui/glade-widget-action.c
@@ -342,13 +342,15 @@ void
 glade_widget_action_class_free (GWActionClass *action)
 {
   if (action->actions)
-    g_list_foreach (action->actions, (GFunc) glade_widget_action_class_free,
-                    NULL);
+    {
+      g_list_free_full (action->actions, (GDestroyNotify) glade_widget_action_class_free);
+      action->actions = NULL;
+    }
 
   /* Dont free id since it points into path directly */
-  g_free (action->path);
-  g_free (action->label);
-  g_free (action->stock);
+  g_clear_pointer (&action->path, g_free);
+  g_clear_pointer (&action->label, g_free);
+  g_clear_pointer (&action->stock, g_free);
 
   g_slice_free (GWActionClass, action);
 }


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