summaryrefslogtreecommitdiff
path: root/src/or/dns.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-05-18 12:21:46 -0400
committerNick Mathewson <nickm@torproject.org>2012-05-18 12:21:46 -0400
commit4c4dd505be30de996659f9d3496fc88956fcfbf6 (patch)
tree6d7fe6218ce2518e272b1537614bc0cf0aa8e928 /src/or/dns.c
parentc1da29e22d138bb30b6ade452aa0e0321330efe3 (diff)
downloadtor-4c4dd505be30de996659f9d3496fc88956fcfbf6.tar.gz
tor-4c4dd505be30de996659f9d3496fc88956fcfbf6.zip
Fix a hard-to-trigger memory leak in launch_resolve
To hit this leak, you need to be a relay that gets a RESOLVE request or an exit node getting a BEGIN or RESOLVE request. You must either have unconfigured (and unconfigurable) nameservers, or you must have somehow set DisableNetwork after a network request arrived but before you managed to process it. So, I doubt this is reached often. Still, a leak's a leak. Fix for bug 5916; bugfix on 0.2.3.9-alpha and 0.1.2.1-alpha.
Diffstat (limited to 'src/or/dns.c')
-rw-r--r--src/or/dns.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/or/dns.c b/src/or/dns.c
index 2b7d3e3506..b349f02f68 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -1389,7 +1389,7 @@ evdns_callback(int result, char type, int count, int ttl, void *addresses,
static int
launch_resolve(edge_connection_t *exitconn)
{
- char *addr = tor_strdup(exitconn->_base.address);
+ char *addr;
struct evdns_request *req = NULL;
tor_addr_t a;
int r;
@@ -1408,6 +1408,8 @@ launch_resolve(edge_connection_t *exitconn)
}
}
+ addr = tor_strdup(exitconn->_base.address);
+
r = tor_addr_parse_PTR_name(
&a, exitconn->_base.address, AF_UNSPEC, 0);