From cfc8c9f8e2d982ee3ebff7afa1d1bdeb04003029 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Sat, 21 Oct 2017 17:38:06 +0200 Subject: Properly dispose the GSList chains We forgot to free the link and the data, oops. --- src/core/misc.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/core/misc.c') diff --git a/src/core/misc.c b/src/core/misc.c index 4e9f4bbe..27741220 100644 --- a/src/core/misc.c +++ b/src/core/misc.c @@ -218,6 +218,19 @@ GSList *gslist_remove_string (GSList *list, const char *str) return list; } +GSList *gslist_delete_string (GSList *list, const char *str, GDestroyNotify free_func) +{ + GSList *l; + + l = g_slist_find_custom(list, str, (GCompareFunc) g_strcmp0); + if (l != NULL) { + free_func(l->data); + return g_slist_delete_link(list, l); + } + + return list; +} + /* `list' contains pointer to structure with a char* to string. */ char *gslistptr_to_string(GSList *list, int offset, const char *delimiter) { -- cgit v1.2.3