summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2017-10-21 17:38:06 +0200
committerLemonBoy <thatlemon@gmail.com>2018-01-07 12:36:19 +0100
commitcfc8c9f8e2d982ee3ebff7afa1d1bdeb04003029 (patch)
tree3fb95e5bbf5292240c6b5f02d202e672b6616184 /src/core
parentf4d811ddf51ce03e90e0417a6c25baeb9aa48353 (diff)
downloadirssi-cfc8c9f8e2d982ee3ebff7afa1d1bdeb04003029.zip
Properly dispose the GSList chains
We forgot to free the link and the data, oops.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/misc.c13
-rw-r--r--src/core/misc.h1
2 files changed, 14 insertions, 0 deletions
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)
{
diff --git a/src/core/misc.h b/src/core/misc.h
index 375744db..689cf5c2 100644
--- a/src/core/misc.h
+++ b/src/core/misc.h
@@ -22,6 +22,7 @@ GSList *gslist_find_icase_string(GSList *list, const char *key);
GList *glist_find_string(GList *list, const char *key);
GList *glist_find_icase_string(GList *list, const char *key);
GSList *gslist_remove_string (GSList *list, const char *str);
+GSList *gslist_delete_string (GSList *list, const char *str, GDestroyNotify free_func);
void gslist_free_full (GSList *list, GDestroyNotify free_func);