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 --- srd.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'srd.c') diff --git a/srd.c b/srd.c index 2947ca8..344919a 100644 --- a/srd.c +++ b/srd.c @@ -219,12 +219,9 @@ SRD_API int srd_init(const char *path) */ SRD_API int srd_exit(void) { - GSList *l; - srd_dbg("Exiting libsigrokdecode."); - for (l = sessions; l; l = l->next) - srd_session_destroy((struct srd_session *)l->data); + g_slist_foreach(sessions, (GFunc)srd_session_destroy, NULL); srd_decoder_unload_all(); g_slist_free_full(searchpaths, g_free); -- cgit v1.2.3-70-g09d2