]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoder.c
valgrind: safely iterate lists
[libsigrokdecode.git] / decoder.c
index eba5a287f4176008aed1568d465a13018c6be866..1151f057f2b5c3e2d4fa5f05ed0fda10cb7e7df6 100644 (file)
--- 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;