From be4a1c4fc09f2f5b7c2f98097e15f84b38f59bc8 Mon Sep 17 00:00:00 2001 From: ergz Date: Tue, 4 Jul 2023 00:54:36 -0700 Subject: [PATCH] stuff --- c/linked_list.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/c/linked_list.c b/c/linked_list.c index 7119429..a4d768b 100644 --- a/c/linked_list.c +++ b/c/linked_list.c @@ -85,6 +85,7 @@ int get_length(LinkedList* list) { } void destroy_list(LinkedList* list) { + // if any nodes are in list destroy them first if (list->length > 0) { Node* current_node = list->head; while (current_node != NULL) { @@ -94,6 +95,7 @@ void destroy_list(LinkedList* list) { } } + // then destroy the list struct itself free(list); }