diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-02-14 12:42:27 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-02-14 12:42:27 -0800 |
commit | c17cf77e4e021194f52f32b0b8def06c7933e89f (patch) | |
tree | c30c81b48072854e8e22cf768328832edf4aab8b /run-command.c | |
parent | Merge branch 'en/string-list-can-be-custom-sorted' into maint (diff) | |
parent | run-command: avoid undefined behavior in exists_in_PATH (diff) | |
download | tgif-c17cf77e4e021194f52f32b0b8def06c7933e89f.tar.xz |
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
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[]) |