You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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);
The text was updated successfully, but these errors were encountered:
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);
The text was updated successfully, but these errors were encountered: