r15249@tombo: nickm | 2008-04-18 09:46:02 -0400

Avoid leaking a string in the unlikely OOM case from name_from_addr. spotted by niels.


svn:r724
This commit is contained in:
Nick Mathewson 2008-04-18 13:46:13 +00:00
parent a404bf9877
commit a55a67d56e

5
http.c
View File

@ -2275,8 +2275,11 @@ evhttp_get_request_connection(
char *hostname = NULL, *portname = NULL; char *hostname = NULL, *portname = NULL;
name_from_addr(sa, salen, &hostname, &portname); name_from_addr(sa, salen, &hostname, &portname);
if (hostname==NULL || portname==NULL) if (hostname==NULL || portname==NULL) {
if (hostname) event_free(hostname);
if (portname) event_free(portname);
return (NULL); return (NULL);
}
event_debug(("%s: new request from %s:%s on %d\n", event_debug(("%s: new request from %s:%s on %d\n",
__func__, hostname, portname, fd)); __func__, hostname, portname, fd));