зеркало из https://github.com/microsoft/git.git
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
d2bbb7c2bc
Коммит
1a845a2c88
|
@ -961,8 +961,10 @@ static char **get_path_split(void)
|
||||||
++n;
|
++n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!n)
|
if (!n) {
|
||||||
|
free(envpath);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
ALLOC_ARRAY(path, n + 1);
|
ALLOC_ARRAY(path, n + 1);
|
||||||
p = envpath;
|
p = envpath;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче