aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-01-22 15:07:31 -0800
committerJunio C Hamano <gitster@pobox.com>2020-01-22 15:07:31 -0800
commit42096c778ddfcc946ea6fc302c46f96d586b5bab (patch)
treeaacce0453facde8560ba7f253ec6c5588d21646a
parentMerge branch 'en/string-list-can-be-custom-sorted' (diff)
parentrun-command: avoid undefined behavior in exists_in_PATH (diff)
downloadgit-42096c778ddfcc946ea6fc302c46f96d586b5bab.tar.xz
git-42096c778ddfcc946ea6fc302c46f96d586b5bab.zip
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
-rw-r--r--run-command.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/run-command.c b/run-command.c
index 9942f120a9b..f5e1149f9b3 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[])