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:
		@@ -251,9 +251,13 @@ static int parseUrl(InputStreamHTTPData * data, char *url)
 | 
				
			|||||||
	if (len <= 1)
 | 
						if (len <= 1)
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (data->host)
 | 
				
			||||||
 | 
							free(data->host);
 | 
				
			||||||
	data->host = xmalloc(len);
 | 
						data->host = xmalloc(len);
 | 
				
			||||||
	memcpy(data->host, temp, len - 1);
 | 
						memcpy(data->host, temp, len - 1);
 | 
				
			||||||
	data->host[len - 1] = '\0';
 | 
						data->host[len - 1] = '\0';
 | 
				
			||||||
 | 
						if (data->port)
 | 
				
			||||||
 | 
							free(data->port);
 | 
				
			||||||
	/* fetch the port */
 | 
						/* fetch the port */
 | 
				
			||||||
	if (colon && (!slash || slash != colon + 1)) {
 | 
						if (colon && (!slash || slash != colon + 1)) {
 | 
				
			||||||
		len = strlen(colon) - 1;
 | 
							len = strlen(colon) - 1;
 | 
				
			||||||
@@ -267,6 +271,8 @@ static int parseUrl(InputStreamHTTPData * data, char *url)
 | 
				
			|||||||
		data->port = xstrdup("80");
 | 
							data->port = xstrdup("80");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (data->path)
 | 
				
			||||||
 | 
							free(data->path);
 | 
				
			||||||
	/* fetch the path */
 | 
						/* fetch the path */
 | 
				
			||||||
	if (proxyHost)
 | 
						if (proxyHost)
 | 
				
			||||||
		data->path = xstrdup(url);
 | 
							data->path = xstrdup(url);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user