From c71cfbac7a461734fad2982867701bba8874f359 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 30 Jun 2008 02:43:08 +0000 Subject: http: fix some small memory leaks when hitting redirects git-svn-id: https://svn.musicpd.org/mpd/trunk@7392 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/inputStream_http.c | 6 ++++++ 1 file changed, 6 insertions(+) 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); -- cgit v1.2.3