http: fix some small memory leaks when hitting redirects
git-svn-id: https://svn.musicpd.org/mpd/trunk@7392 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
8426740f44
commit
c71cfbac7a
@ -251,9 +251,13 @@ static int parseUrl(InputStreamHTTPData * data, char *url)
|
||||
if (len <= 1)
|
||||
return -1;
|
||||
|
||||
if (data->host)
|
||||
free(data->host);
|
||||
data->host = xmalloc(len);
|
||||
memcpy(data->host, temp, len - 1);
|
||||
data->host[len - 1] = '\0';
|
||||
if (data->port)
|
||||
free(data->port);
|
||||
/* fetch the port */
|
||||
if (colon && (!slash || slash != colon + 1)) {
|
||||
len = strlen(colon) - 1;
|
||||
@ -267,6 +271,8 @@ static int parseUrl(InputStreamHTTPData * data, char *url)
|
||||
data->port = xstrdup("80");
|
||||
}
|
||||
|
||||
if (data->path)
|
||||
free(data->path);
|
||||
/* fetch the path */
|
||||
if (proxyHost)
|
||||
data->path = xstrdup(url);
|
||||
|
Loading…
Reference in New Issue
Block a user