File fix-memory-leak.patch of Package pasystray

From 23806233251ea77cf43921220cac5b66874b481a Mon Sep 17 00:00:00 2001
From: Christoph Gysin <christoph.gysin@gmail.com>
Date: Sat, 11 Nov 2017 18:04:32 +0200
Subject: [PATCH] systray: fix memory leak

Thanks to @l12436

fixes #94
---
 src/systray.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/systray.c b/src/systray.c
index 58dbc71..dfe806d 100644
--- a/src/systray.c
+++ b/src/systray.c
@@ -144,8 +144,10 @@ void systray_remove_placeholder(menu_info_t* mi)
     if(g_hash_table_size(mi->items) == 0)
     {
         GList* children = gtk_container_get_children(GTK_CONTAINER(mi->menu));
-        if(children)
+        if(children) {
             gtk_container_remove(GTK_CONTAINER(mi->menu), GTK_WIDGET(children->data));
+            g_list_free(children);
+        }
     }
 }
 
@@ -192,10 +194,12 @@ void systray_remove_radio_item(menu_info_t* mi, GtkWidget* item)
 
     /* update group */
     GList* children = gtk_container_get_children(GTK_CONTAINER(mi->menu));
-    if(children)
+    if(children) {
         mi->group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(children->data));
-    else
+        g_list_free(children);
+    } else {
         mi->group = NULL;
+    }
 }
 
 GtkWidget* systray_add_item(GtkMenuShell* menu, const char* desc, const char* tooltip, const char* icon)
openSUSE Build Service is sponsored by