eina: Set it to NULL before next iteration
authorSebastian Dransfeld <sd@tango.flipp.net>
Sat, 7 Dec 2013 12:59:16 +0000 (13:59 +0100)
committerSebastian Dransfeld <sd@tango.flipp.net>
Sat, 7 Dec 2013 20:11:32 +0000 (21:11 +0100)
it might have been free'd by the user, so set it to NULL before next
iteration. This is an attempt to fix CID 1039913 and 1039914.

We don't use the pointer value, only the pointer, so the error is wrong.
Could flag the error in coverity, but if this fixes it, we wont see the
error in other situations.

src/lib/eina/eina_inlist.h

index ccca63e..dd2fd73 100644 (file)
@@ -844,7 +844,7 @@ EAPI Eina_Inlist *eina_inlist_sort(Eina_Inlist *head, Eina_Compare_Cb func);
 #define EINA_INLIST_FOREACH_SAFE(list, list2, it) \
    for (it = NULL, it = (list ? _EINA_INLIST_CONTAINER(it, list) : NULL), list2 = it ? EINA_INLIST_GET(it)->next : NULL; \
         it; \
-        it = list2 ? _EINA_INLIST_CONTAINER(it, list2) : NULL, list2 = list2 ? list2->next : NULL)
+        it = NULL, it = list2 ? _EINA_INLIST_CONTAINER(it, list2) : NULL, list2 = list2 ? list2->next : NULL)
 
 /**
  * @def EINA_INLIST_REVERSE_FOREACH