[or-cvs] r17680: {tor} Do not leak the DNS server port structure. (tor/trunk/src/or)
nickm at seul.org
nickm at seul.org
Thu Dec 18 15:00:18 UTC 2008
Author: nickm
Date: 2008-12-18 10:00:18 -0500 (Thu, 18 Dec 2008)
New Revision: 17680
Modified:
tor/trunk/src/or/eventdns.c
Log:
Do not leak the DNS server port structure.
Modified: tor/trunk/src/or/eventdns.c
===================================================================
--- tor/trunk/src/or/eventdns.c 2008-12-18 15:00:13 UTC (rev 17679)
+++ tor/trunk/src/or/eventdns.c 2008-12-18 15:00:18 UTC (rev 17680)
@@ -1598,9 +1598,9 @@
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 @@
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 @@
}
(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 */
More information about the tor-commits
mailing list