nissy-classic

Stable branch of nissy
git clone https://git.tronto.net/nissy-classic
Download | Log | Files | Refs | README | LICENSE

commit 8cf0d9d94b91d036d44fa02ebe5f6acea594a6d8
parent 6cbd6f165ce3f063c5f940e38dd9a2132106a9ee
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date:   Sat,  6 May 2023 14:32:29 +0200

Added sanitizers for debug compile, fixed memory leak

Diffstat:
MMakefile | 4+++-
Msrc/shell.c | 6++++--
2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile @@ -9,7 +9,9 @@ CPPFLAGS = -DVERSION=\"${VERSION}\" CFLAGS = -std=c99 -pthread -pedantic -Wall -Wextra \ -Wno-unused-parameter -O3 ${CPPFLAGS} DBGFLAGS = -std=c99 -pthread -pedantic -Wall -Wextra \ - -Wno-unused-parameter -g ${CPPFLAGS} + -Wno-unused-parameter -Wno-unused-function \ + -fsanitize=address -fsanitize=undefined \ + -g3 ${CPPFLAGS} CC = cc diff --git 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); }