diff --git a/lib/types/slist.c b/lib/types/slist.c index 1af596c4fe6046c4c15391d6b0f964987e022da7..6a718dddd323190e3a8a2fa5e07d7e5d78699b45 100644 --- a/lib/types/slist.c +++ b/lib/types/slist.c @@ -102,5 +102,14 @@ void slist_free_all (SList *list, FreeFunc func) { - slist_foreach (list, (ForEachFunc) slist_free_one, NULL); + SList *next; + + if (!list) + return; + + for (SList *l = list; l; l = next) + { + next = l->next; + slist_free_one (l, func); + } }