diff options
author | Karl Palsson <karlp@etactica.com> | 2016-11-25 13:55:56 +0000 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2016-12-06 22:10:14 +0100 |
commit | 95e40a0ce2e27ba6ea7c97d9956918336160bf7b (patch) | |
tree | 470f431827349ca91cdecb49c26834eee5c472da /decoder.c | |
parent | de22de7f5d6e371f4c8cdd2b211b8e5a1fbe973a (diff) | |
download | libsigrokdecode-95e40a0ce2e27ba6ea7c97d9956918336160bf7b.tar.gz libsigrokdecode-95e40a0ce2e27ba6ea7c97d9956918336160bf7b.zip |
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 <karlp@etactica.com>
Diffstat (limited to 'decoder.c')
-rw-r--r-- | decoder.c | 8 |
1 files changed, 1 insertions, 7 deletions
@@ -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; |