diff options
author | Preston Pan <preston@nullring.xyz> | 2023-01-08 15:39:19 -0800 |
---|---|---|
committer | Preston Pan <preston@nullring.xyz> | 2023-01-08 15:39:19 -0800 |
commit | 19367a27472a06634424e56c1eb21e4f53da4e9e (patch) | |
tree | fc58a08d36d451bdd1e7143a7358ac8a374355f7 /src/stack.c | |
parent | 87d82ead963c24d84a4f6e417b96b9bf73d132bb (diff) |
fixed invalid read; some memory leakage fixed but not completely
Diffstat (limited to 'src/stack.c')
-rw-r--r-- | src/stack.c | 7 |
1 files changed, 7 insertions, 0 deletions
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); +} |