aboutsummaryrefslogtreecommitdiff
path: root/libs/libc/list.c
diff options
context:
space:
mode:
authorMarvin Borner2021-05-15 22:36:21 +0200
committerMarvin Borner2021-05-15 22:36:21 +0200
commitdf5a8c5b32733ae5e2d872b1c7baa4311a9d2308 (patch)
tree460b35ad421bc74e75e942a35379621ba168c9ea /libs/libc/list.c
parentf97343c268b0fc19bf93d509a019f3d13c7af5a4 (diff)
Strange fixes
I have no ideas halp
Diffstat (limited to 'libs/libc/list.c')
-rw-r--r--libs/libc/list.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libs/libc/list.c b/libs/libc/list.c
index 53bfa08..bda9e20 100644
--- a/libs/libc/list.c
+++ b/libs/libc/list.c
@@ -22,11 +22,12 @@ void list_destroy(struct list *list)
break;
}
iterator = iterator->next;
- free(iterator->prev);
+
+ if (iterator && iterator->prev)
+ free(iterator->prev);
}
- list->head = NULL;
+ memset(list, 0, sizeof(*list));
free(list);
- list = NULL;
}
static struct node *list_new_node(void)