summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-01-22 23:07:31 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-01-22 23:07:31 (GMT)
commit42096c778ddfcc946ea6fc302c46f96d586b5bab (patch)
treeaacce0453facde8560ba7f253ec6c5588d21646a
parent1f10b84e43cbcf50715b6effd858530e14626952 (diff)
parent63ab08fb9999bf9547c5279a8c2f0cdd8bb679ca (diff)
downloadgit-42096c778ddfcc946ea6fc302c46f96d586b5bab.zip
git-42096c778ddfcc946ea6fc302c46f96d586b5bab.tar.gz
git-42096c778ddfcc946ea6fc302c46f96d586b5bab.tar.bz2
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 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[])