diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-01-22 15:07:31 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-01-22 15:07:31 -0800 |
commit | 42096c778ddfcc946ea6fc302c46f96d586b5bab (patch) | |
tree | aacce0453facde8560ba7f253ec6c5588d21646a /run-command.c | |
parent | 1f10b84e43cbcf50715b6effd858530e14626952 (diff) | |
parent | 63ab08fb9999bf9547c5279a8c2f0cdd8bb679ca (diff) | |
download | git-42096c778ddfcc946ea6fc302c46f96d586b5bab.tar.gz |
Merge branch 'bc/run-command-nullness-after-free-fix'
C pedantry ;-) fix.
* bc/run-command-nullness-after-free-fix:
run-command: avoid undefined behavior in exists_in_PATH
Diffstat (limited to 'run-command.c')
-rw-r--r-- | run-command.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/run-command.c b/run-command.c index 9942f120a9..f5e1149f9b 100644 --- a/run-command.c +++ b/run-command.c @@ -213,8 +213,9 @@ static char *locate_in_PATH(const char *file) static int exists_in_PATH(const char *file) { char *r = locate_in_PATH(file); + int found = r != NULL; free(r); - return r != NULL; + return found; } int sane_execvp(const char *file, char * const argv[]) |