From: R. Steve McKown Date: Fri, 28 Sep 2012 15:58:54 +0000 (-0600) Subject: Proper free on execvp fail X-Git-Tag: 0.5~21 X-Git-Url: https://oss.titaniummirror.com/gitweb?p=repo_shell.git;a=commitdiff_plain;h=180b28ed0209f51ae2ec79cfe5f4c153f3490f3d Proper free on execvp fail --- diff --git a/repo_shell.c b/repo_shell.c index 660c2fd..86e27b2 100644 --- a/repo_shell.c +++ b/repo_shell.c @@ -58,7 +58,7 @@ static char *dequote(char *arg) static char *add_prefix(char *prefix, char* arg) { char *narg = arg; - int i; + int i; if (arg && prefix && (i = strlen(prefix))) { narg = xmalloc(sizeof(char *) * (i + strlen(arg) + 2)); @@ -113,6 +113,7 @@ static int do_git_cmd(const char *cmd, char *arg, char *user) ret = execvp(nargv[0], (char *const *) nargv); /* Code unreached if execv successful */ + free((char*)nargv[1]); free(narg); return ret; }