Merge branch 'bc/run-command-nullness-after-free-fix' into maint

C pedantry ;-) fix.

* bc/run-command-nullness-after-free-fix:
  run-command: avoid undefined behavior in exists_in_PATH
This commit is contained in:
Junio C Hamano 2020-02-14 12:42:27 -08:00
commit c17cf77e4e

View File

@ -213,8 +213,9 @@ static char *locate_in_PATH(const char *file)
static int exists_in_PATH(const char *file) static int exists_in_PATH(const char *file)
{ {
char *r = locate_in_PATH(file); char *r = locate_in_PATH(file);
int found = r != NULL;
free(r); free(r);
return r != NULL; return found;
} }
int sane_execvp(const char *file, char * const argv[]) int sane_execvp(const char *file, char * const argv[])