diff --git a/src/context.c b/src/context.c index ba51d90c..c52f770b 100644 --- a/src/context.c +++ b/src/context.c @@ -693,9 +693,10 @@ _getdns_upstreams_dereference(getdns_upstreams *upstreams) upstream->finished_dnsreqs = dnsreq->finished_next; _getdns_context_cancel_request(dnsreq); } + if (upstream->tls_session != NULL) + SSL_SESSION_free(upstream->tls_session); + if (upstream->tls_obj != NULL) { - if (upstream->tls_session != NULL) - SSL_SESSION_free(upstream->tls_session); SSL_shutdown(upstream->tls_obj); SSL_free(upstream->tls_obj); } diff --git a/src/request-internal.c b/src/request-internal.c index 7663e37c..1bd5475e 100644 --- a/src/request-internal.c +++ b/src/request-internal.c @@ -110,9 +110,9 @@ network_req_cleanup(getdns_network_req *net_req) if (net_req->response && (net_req->response < net_req->wire_data || net_req->response > net_req->wire_data+ net_req->wire_data_sz)) GETDNS_FREE(net_req->owner->my_mf, net_req->response); - if (netreq->debug_tls_peer_cert.size && - netreq->debug_tls_peer_cert.data) - OPENSSL_free(netreq->debug_tls_peer_cert.data); + if (net_req->debug_tls_peer_cert.size && + net_req->debug_tls_peer_cert.data) + OPENSSL_free(net_req->debug_tls_peer_cert.data); } static uint8_t *