aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-06-30 02:43:08 +0000
committerEric Wong <normalperson@yhbt.net>2008-06-30 02:43:08 +0000
commitc71cfbac7a461734fad2982867701bba8874f359 (patch)
tree63b1aa69aaa1a3973b801d6e71d60b74e8a2cbd4
parent8426740f44e6584e291f23ac9858754111221395 (diff)
downloadmpd-c71cfbac7a461734fad2982867701bba8874f359.tar.gz
mpd-c71cfbac7a461734fad2982867701bba8874f359.tar.xz
mpd-c71cfbac7a461734fad2982867701bba8874f359.zip
http: fix some small memory leaks when hitting redirects
git-svn-id: https://svn.musicpd.org/mpd/trunk@7392 09075e82-0dd4-0310-85a5-a0d7c8717e4f
-rw-r--r--src/inputStream_http.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/inputStream_http.c b/src/inputStream_http.c
index 804862714..c2009cfb7 100644
--- a/src/inputStream_http.c
+++ b/src/inputStream_http.c
@@ -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);