fix: critical, fixed list_empty not actually freeing the allocated list
leading to orphanned memorymain
parent
b38362c2aa
commit
cb0858f14f
4
list.c
4
list.c
|
@ -37,8 +37,8 @@ List list_copy(const List* source) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void list_empty(List* self) {
|
void list_empty(List* self) {
|
||||||
if(self->data == NULL || self->cap == 0)
|
if(self->data != NULL && self->cap != 0)
|
||||||
return;
|
free(self->data);
|
||||||
self->data = NULL;
|
self->data = NULL;
|
||||||
self->cap = 0;
|
self->cap = 0;
|
||||||
self->len = 0;
|
self->len = 0;
|
||||||
|
|
Loading…
Reference in New Issue