diff --git a/list.c b/list.c index 6c2bf04..9ce434a 100644 --- a/list.c +++ b/list.c @@ -37,8 +37,8 @@ List list_copy(const List* source) { } void list_empty(List* self) { - if(self->data == NULL || self->cap == 0) - return; + if(self->data != NULL && self->cap != 0) + free(self->data); self->data = NULL; self->cap = 0; self->len = 0;