Mon, 27 Sep 2021 17:00:19 +0200
add node destruction in cxLinkedListDestroy()
src/linked_list.c | file | annotate | diff | comparison | revisions |
--- a/src/linked_list.c Sun Sep 26 18:31:24 2021 +0200 +++ b/src/linked_list.c Mon Sep 27 17:00:19 2021 +0200 @@ -177,7 +177,15 @@ } void cxLinkedListDestroy(CxList list) { - // TODO: free contents + cx_linked_list* ll = (cx_linked_list*) list; + + struct cx_linked_list_node* node = ll->begin; + while (node) { + void* next = node->next; + cxFree(list->allocator, node); + node = next; + } + cxFree(list->allocator, list); }