OSDN Git Service
(root)
/
git-core
/
git.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d2bbb7c
)
mingw: avoid memory leak when splitting PATH
author
Johannes Schindelin
<johannes.schindelin@gmx.de>
Thu, 4 May 2017 13:55:24 +0000
(15:55 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 8 May 2017 03:18:19 +0000
(12:18 +0900)
In the (admittedly, concocted) case that PATH consists only of path
delimiters, we would leak the duplicated string.
Reported by Coverity.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
compat/mingw.c
patch
|
blob
|
history
diff --git
a/compat/mingw.c
b/compat/mingw.c
index
3fbfda5
..
fe0e3cc
100644
(file)
--- a/
compat/mingw.c
+++ b/
compat/mingw.c
@@
-961,8
+961,10
@@
static char **get_path_split(void)
++n;
}
}
- if (!n)
+ if (!n) {
+ free(envpath);
return NULL;
+ }
ALLOC_ARRAY(path, n + 1);
p = envpath;