From a55a67d56e989b9f7fa2027f2c75bec8a55a9a87 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 18 Apr 2008 13:46:13 +0000 Subject: [PATCH] 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 --- http.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/http.c b/http.c index efd9f7b7..b9f33882 100644 --- a/http.c +++ b/http.c @@ -2275,8 +2275,11 @@ evhttp_get_request_connection( char *hostname = NULL, *portname = NULL; 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); + } event_debug(("%s: new request from %s:%s on %d\n", __func__, hostname, portname, fd));