Identified by clang-tidy: exec.c:21:2: warning: Potential leak of memory pointed to by 'argv' [clang-analyzer-unix.Malloc] return execvp(file, argv); ^ exec.c:15:16: note: Memory is allocated char **argv = calloc(argz_count(argz, len) + 1, sizeof(char *)); ^ exec.c:16:6: note: Assuming 'argv' is non-null if (!argv) ^ exec.c:16:2: note: Taking false branch if (!argv) ^ exec.c:21:2: note: Potential leak of memory pointed to by 'argv' return execvp(file, argv); --- I'm not used to thinking about allocations around exec, since usually if it fails the program just terminates. But in a function like this, the rules are a bit different. exec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/exec.c b/exec.c index cc55200..75b1980 100644 --- a/exec.c +++ b/exec.c @@ -18,5 +18,8 @@ int execzp(const char *file, const char *argz, size_t len) argz_extract(argz, len, argv); - return execvp(file, argv); + execvp(file, argv); + + free(argv); + return -1; } -- 2.30.0