mingw: avoid memory leak when splitting PATH

In the (admittedly, concocted) case that PATH consists only of colons, we
would leak the duplicated string.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2017-04-19 16:16:44 +02:00
parent f811241018
commit edffb73b20

View File

@@ -1164,8 +1164,10 @@ static char **get_path_split(void)
++n;
}
}
if (!n)
if (!n) {
free(envpath);
return NULL;
}
ALLOC_ARRAY(path, n + 1);
p = envpath;