--- a/libpurple/desktopitem.c Thu Feb 11 23:57:10 2021 -0600 +++ b/libpurple/desktopitem.c Fri Feb 12 04:07:08 2021 -0600 @@ -59,6 +59,7 @@ #include <string.h> #include <time.h> #include "desktopitem.h" +#include "glibcompat.h" struct _PurpleDesktopItem { int refcount; @@ -1113,15 +1114,12 @@ } static void -free_section (gpointer data, gpointer user_data) +free_section (Section *section) { - Section *section = data; - g_free (section->name); section->name = NULL; - g_list_foreach (section->keys, (GFunc)g_free, NULL); - g_list_free (section->keys); + g_list_free_full(section->keys, (GDestroyNotify)g_free); section->keys = NULL; g_free (section); @@ -1237,16 +1235,13 @@ if(item->refcount != 0) return; - g_list_foreach (item->languages, (GFunc)g_free, NULL); - g_list_free (item->languages); + g_list_free_full(item->languages, (GDestroyNotify)g_free); item->languages = NULL; - g_list_foreach (item->keys, (GFunc)g_free, NULL); - g_list_free (item->keys); + g_list_free_full(item->keys, (GDestroyNotify)g_free); item->keys = NULL; - g_list_foreach (item->sections, free_section, NULL); - g_list_free (item->sections); + g_list_free_full(item->sections, (GDestroyNotify)free_section); item->sections = NULL; g_hash_table_destroy (item->main_hash);