]> granicus.if.org Git - libevent/commitdiff
Avoid a memory-leak on OOM in evdns.
authorGeorge Danchev <danchev@spnet.net>
Thu, 13 Sep 2012 00:11:12 +0000 (20:11 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 13 Sep 2012 00:11:12 +0000 (20:11 -0400)
evdns.c

diff --git a/evdns.c b/evdns.c
index e9cea45b52720535633c2577fcf2453cb5784630..7b0fc2bd41a33fa02787fb2fa3a763090c6359ed 100644 (file)
--- a/evdns.c
+++ b/evdns.c
@@ -2291,7 +2291,10 @@ nameserver_send_probe(struct nameserver *const ns) {
        handle = mm_calloc(1, sizeof(*handle));
        if (!handle) return;
        req = request_new(ns->base, handle, TYPE_A, "google.com", DNS_QUERY_NO_SEARCH, nameserver_probe_callback, ns);
-       if (!req) return;
+       if (!req) {
+               mm_free(handle);
+               return;
+       }
        ns->probe_request = handle;
        /* we force this into the inflight queue no matter what */
        request_trans_id_set(req, transaction_id_pick(ns->base));