list icon indicating copy to clipboard operation
list copied to clipboard

malloc free

Open jamesbankkkk opened this issue 8 years ago • 4 comments

for the iterator, when malloc a ptr to iterator, we should use (list_iterator_t **ptr)to destroy, because void list_iterator_destroy(list_iterator_t *self) { LIST_FREE(self); self = NULL; }

this is not save, because the if (val == node->val) { list_iterator_destroy(it); return node; } it still ptr the memory of free

we should use list_iterator_destory(&it);

jamesbankkkk avatar Dec 23 '16 08:12 jamesbankkkk

PR welcome! =)

stephenmathieson avatar Dec 23 '16 18:12 stephenmathieson

every good

jamesbankkkk avatar Dec 24 '16 05:12 jamesbankkkk

my colleague said that is the end of code, so can do

jamesbankkkk avatar Dec 24 '16 06:12 jamesbankkkk

why in another place, at the list_iterator_destroy(..){LIST_FREE(self); self = null;} why you use null,

jamesbankkkk avatar Dec 24 '16 13:12 jamesbankkkk