From 19367a27472a06634424e56c1eb21e4f53da4e9e Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Sun, 8 Jan 2023 15:39:19 -0800 Subject: fixed invalid read; some memory leakage fixed but not completely --- src/stack.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/stack.c') diff --git a/src/stack.c b/src/stack.c index ebfa640..ba43023 100644 --- a/src/stack.c +++ b/src/stack.c @@ -43,3 +43,10 @@ bool is_empty(stack_t *s) { return true; return false; } + +void stack_free(stack_t *s) { + if (s->stack != NULL) { + free(s->stack); + } + free(s); +} -- cgit