From 7e9956b19e1844f75de3b14850e34ba9baa58ce5 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Fri, 17 Feb 2017 23:39:35 +0100 Subject: [PATCH] Call cancel callbacks only when callback exists --- src/context.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/context.c b/src/context.c index 830c4c53..39f2dbb0 100644 --- a/src/context.c +++ b/src/context.c @@ -3275,9 +3275,11 @@ _getdns_context_request_timed_out(getdns_dns_req *req) /* cancel the req - also clears it from outbound and cleans up*/ _getdns_context_cancel_request(context, trans_id, 0); - context->processing = 1; - cb(context, GETDNS_CALLBACK_TIMEOUT, response, user_arg, trans_id); - context->processing = 0; + if (cb) { + context->processing = 1; + cb(context, GETDNS_CALLBACK_TIMEOUT, response, user_arg, trans_id); + context->processing = 0; + } getdns_context_request_count_changed(context); return GETDNS_RETURN_GOOD; }