summaryrefslogtreecommitdiff
path: root/run-command.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2020-02-14 12:42:27 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-02-14 12:42:27 -0800
commitc17cf77e4e021194f52f32b0b8def06c7933e89f (patch)
treec30c81b48072854e8e22cf768328832edf4aab8b /run-command.c
parentMerge branch 'en/string-list-can-be-custom-sorted' into maint (diff)
parentrun-command: avoid undefined behavior in exists_in_PATH (diff)
downloadtgif-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.c3
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[])