Cleaning improved when quitting.

master
Tomasz Polgrabia 2025-02-06 21:22:14 +01:00
parent 22c097789f
commit be71494725
1 changed files with 3 additions and 0 deletions

View File

@ -38,9 +38,12 @@ void visit_node_pre_order(node *q, void (*callback)(node *)) {
void node_destroy(list *q) {
void (*func)(node *) = (void (*)(node *))free;
list *t = q;
list *prev = NULL;
while (t) {
visit_node_post_order(t->node, func);
prev = t;
t = t->next;
free(prev);
}
}