fix: critical, fixed list_empty not actually freeing the allocated list

leading to orphanned memory
main
Sara 2024-01-26 12:01:41 +01:00
parent b38362c2aa
commit cb0858f14f
1 changed files with 2 additions and 2 deletions

4
list.c
View File

@ -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;