summaryrefslogtreecommitdiff
path: root/src/or/eventdns.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-12-18 15:00:18 +0000
committerNick Mathewson <nickm@torproject.org>2008-12-18 15:00:18 +0000
commit148e4e88371510b9d7f3dc4768346b66faed39d4 (patch)
treea3b5fabde35e56858a7219889a37b77effc83fbb /src/or/eventdns.c
parent4911ec627b22fb72ec616a18298014780235c396 (diff)
downloadtor-148e4e88371510b9d7f3dc4768346b66faed39d4.tar.gz
tor-148e4e88371510b9d7f3dc4768346b66faed39d4.zip
Do not leak the DNS server port structure.
svn:r17680
Diffstat (limited to 'src/or/eventdns.c')
-rw-r--r--src/or/eventdns.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/or/eventdns.c b/src/or/eventdns.c
index 6a56b508be..2b28b2bf94 100644
--- a/src/or/eventdns.c
+++ b/src/or/eventdns.c
@@ -1598,9 +1598,9 @@ evdns_add_server_port(int socket, int is_tcp, evdns_request_callback_fn_type cb,
void
evdns_close_server_port(struct evdns_server_port *port)
{
+ port->closing = 1;
if (--port->refcnt == 0)
server_port_free(port);
- port->closing = 1;
}
/* exported function */
@@ -1943,7 +1943,8 @@ server_request_free(struct server_request *req)
return (0);
}
-/* Free all storage held by an evdns_server_port. Only called when */
+/* Free all storage held by an evdns_server_port. Only called when the
+ * reference count is down to 0. */
static void
server_port_free(struct evdns_server_port *port)
{
@@ -1956,8 +1957,8 @@ server_port_free(struct evdns_server_port *port)
}
(void) event_del(&port->event);
CLEAR(&port->event);
- /* XXXX021 actually free the port? -NM */
- /* XXXX yes, and fix up evdns_close_server_port to dtrt. -NM */
+ CLEAR(port);
+ free(port);
}
/* exported function */