From: Jon Feldman Date: Wed, 26 Jul 2017 13:49:20 +0000 (-0400) Subject: shell: clean up memory X-Git-Url: https://chaos.moe/g/?a=commitdiff_plain;h=ea458a10885ec5c452e3460a582108bf19eaf77e;p=misc%2Fysh.git shell: clean up memory --- diff --git a/gsh_main.c b/gsh_main.c index 58e0fe6..715cbe9 100644 --- a/gsh_main.c +++ b/gsh_main.c @@ -484,6 +484,8 @@ int main(int argc, char **argv) { ast_t *toks = parse(run_str); toks = resolve(toks); execute(toks, NULL); + free(toks->ptr); + free(toks); } else { while (!shell_do_exit) { // Read a command in. @@ -491,6 +493,8 @@ int main(int argc, char **argv) { ast_t *toks = parse(input); toks = resolve(toks); execute(toks, NULL); + free(toks->ptr); + free(toks); // FIXME: free the damn toks memory, this requires traversing to the bottom tho free(input); }