From 8cf0d9d94b91d036d44fa02ebe5f6acea594a6d8 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sat, 6 May 2023 14:32:29 +0200 Subject: Added sanitizers for debug compile, fixed memory leak --- src/shell.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/shell.c b/src/shell.c index 9c3173b..3c19a31 100644 --- a/src/shell.c +++ b/src/shell.c @@ -64,13 +64,13 @@ exec_args(int c, char **v) if (cmd == NULL) { fprintf(stderr, "%s: command not found\n", v[0]); - return; + goto exec_args_end; } args = cmd->parse_args(c-1, &v[1]); if (!args->success) { fprintf(stderr, "usage: %s\n", cmd->usage); - return; + goto exec_args_end; } if (args->scrstdin) { @@ -94,6 +94,8 @@ exec_args(int c, char **v) } else { cmd->exec(args); } + +exec_args_end: free_args(args); } -- cgit v1.3