mirror of
https://github.com/git/git.git
synced 2026-01-25 10:03:24 +00:00
mingw: avoid memory leak when splitting PATH
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>
This commit is contained in:
@@ -1166,8 +1166,10 @@ static char **get_path_split(void)
|
||||
++n;
|
||||
}
|
||||
}
|
||||
if (!n)
|
||||
if (!n) {
|
||||
free(envpath);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ALLOC_ARRAY(path, n + 1);
|
||||
p = envpath;
|
||||
|
||||
Reference in New Issue
Block a user