]> granicus.if.org Git - libevent/commitdiff
Fix possible NULL-deref in evdns_cancel_request
authorSebastian Hahn <sebastian@torproject.org>
Mon, 14 Mar 2011 03:24:33 +0000 (04:24 +0100)
committerSebastian Hahn <sebastian@torproject.org>
Sat, 23 Apr 2011 00:04:58 +0000 (02:04 +0200)
The clang static analyzer complained that base might be dereferenced
without being set, but this patch should fix another dereference issue.

evdns.c

diff --git a/evdns.c b/evdns.c
index 8c27854283a594f6d85afb717458e7a1d793c482..dad100b1adee5d992098b015bf37a56bac167fc5 100644 (file)
--- a/evdns.c
+++ b/evdns.c
@@ -2699,10 +2699,13 @@ evdns_cancel_request(struct evdns_base *base, struct evdns_request *handle)
 {
        struct request *req;
 
+       if (!handle->current_req)
+               return;
+
        if (!base) {
                /* This redundancy is silly; can we fix it? (Not for 2.0) XXXX */
                base = handle->base;
-               if (!base && handle->current_req)
+               if (!base)
                        base = handle->current_req->base;
        }