From 95e40a0ce2e27ba6ea7c97d9956918336160bf7b Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Fri, 25 Nov 2016 13:55:56 +0000 Subject: valgrind: safely iterate lists Old versions triggered valgrind errors as the API method to remove an entry modifies the list that was being iterated. Signed-off-by: Karl Palsson --- decoder.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'decoder.c') diff --git a/decoder.c b/decoder.c index eba5a28..1151f05 100644 --- a/decoder.c +++ b/decoder.c @@ -992,13 +992,7 @@ SRD_API int srd_decoder_load_all(void) */ SRD_API int srd_decoder_unload_all(void) { - GSList *l; - struct srd_decoder *dec; - - for (l = pd_list; l; l = l->next) { - dec = l->data; - srd_decoder_unload(dec); - } + g_slist_foreach(pd_list, (GFunc)srd_decoder_unload, NULL); g_slist_free(pd_list); pd_list = NULL; -- cgit v1.2.3-70-g09d2