aboutsummaryrefslogtreecommitdiff
path: root/libs/libc/stack.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/stack.c
parentf97343c268b0fc19bf93d509a019f3d13c7af5a4 (diff)
Strange fixes
I have no ideas halp
Diffstat (limited to 'libs/libc/stack.c')
-rw-r--r--libs/libc/stack.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libs/libc/stack.c b/libs/libc/stack.c
index 6f16709..81c76a2 100644
--- a/libs/libc/stack.c
+++ b/libs/libc/stack.c
@@ -22,11 +22,12 @@ void stack_destroy(struct stack *stack)
break;
}
iterator = iterator->prev;
- free(iterator->next);
+
+ if (iterator && iterator->prev)
+ free(iterator->prev);
}
- stack->tail = NULL;
+ memset(stack, 0, sizeof(*stack));
free(stack);
- stack = NULL;
}
static struct stack_node *stack_new_node(void)