Mon, 27 Sep 2021 17:00:19 +0200
add node destruction in cxLinkedListDestroy()
src/linked_list.c | file | annotate | diff | comparison | revisions |
1.1 --- a/src/linked_list.c Sun Sep 26 18:31:24 2021 +0200 1.2 +++ b/src/linked_list.c Mon Sep 27 17:00:19 2021 +0200 1.3 @@ -177,7 +177,15 @@ 1.4 } 1.5 1.6 void cxLinkedListDestroy(CxList list) { 1.7 - // TODO: free contents 1.8 + cx_linked_list* ll = (cx_linked_list*) list; 1.9 + 1.10 + struct cx_linked_list_node* node = ll->begin; 1.11 + while (node) { 1.12 + void* next = node->next; 1.13 + cxFree(list->allocator, node); 1.14 + node = next; 1.15 + } 1.16 + 1.17 cxFree(list->allocator, list); 1.18 } 1.19