roken: fix theoretical leak introduced in 7fbe7be6
split_spec() should free output parameters if it fails. This was not a leak in practice because its single caller cleaned up anyway, but cleaning up for good hygiene.
This commit is contained in:
@@ -102,8 +102,11 @@ split_spec(const char *spec, char **host, int *port, char **path, int def_port)
|
|||||||
if(p) {
|
if(p) {
|
||||||
if(path) {
|
if(path) {
|
||||||
*path = strdup(p);
|
*path = strdup(p);
|
||||||
if (*path == NULL)
|
if (*path == NULL) {
|
||||||
|
free(*host);
|
||||||
|
*host = NULL;
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
}else
|
}else
|
||||||
|
Reference in New Issue
Block a user