pidgin/pidgin

gtk: fix a PurpleActionMenu use after free
use-after-free
14 months ago, Fabrice Bellet
e3d3676df758
Parents 905872c9dd7a
Children 0682910c702a
gtk: fix a PurpleActionMenu use after free
--- a/pidgin/gtkutils.c Tue Dec 10 04:43:23 2019 +0000
+++ b/pidgin/gtkutils.c Wed Dec 18 22:41:28 2019 +0100
@@ -1463,9 +1463,9 @@
callback(object, data);
}
-GtkWidget *
-pidgin_append_menu_action(GtkWidget *menu, PurpleActionMenu *act,
- gpointer object)
+static GtkWidget *
+do_pidgin_append_menu_action(GtkWidget *menu, PurpleActionMenu *act,
+ gpointer object)
{
GtkWidget *menuitem;
GList *list;
@@ -1522,11 +1522,17 @@
for (l = list; l; l = l->next) {
PurpleActionMenu *act = (PurpleActionMenu *)l->data;
- pidgin_append_menu_action(submenu, act, object);
+ do_pidgin_append_menu_action(submenu, act, object);
}
- g_list_free(list);
- purple_action_menu_set_children(act, NULL);
}
+ return menuitem;
+}
+
+GtkWidget *
+pidgin_append_menu_action(GtkWidget *menu, PurpleActionMenu *act,
+ gpointer object)
+{
+ GtkWidget *menuitem = do_pidgin_append_menu_action(menu, act, object);
purple_action_menu_free(act);
return menuitem;
}