diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-02-14 20:42:27 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-02-14 20:42:27 (GMT) |
commit | c17cf77e4e021194f52f32b0b8def06c7933e89f (patch) | |
tree | c30c81b48072854e8e22cf768328832edf4aab8b | |
parent | d0ebd645b191c4f46a9d9122d1f88d7549a32f45 (diff) | |
parent | 63ab08fb9999bf9547c5279a8c2f0cdd8bb679ca (diff) | |
download | git-c17cf77e4e021194f52f32b0b8def06c7933e89f.zip git-c17cf77e4e021194f52f32b0b8def06c7933e89f.tar.gz git-c17cf77e4e021194f52f32b0b8def06c7933e89f.tar.bz2 |
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
-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 9942f12..f5e1149 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[]) |