Fix memory leak

This commit is contained in:
Willem Toorop 2017-03-25 21:33:30 +01:00
parent 5f6e47d091
commit 3eb6ebf5e4
3 changed files with 6 additions and 2 deletions

View File

@ -110,6 +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);
}
static uint8_t *

View File

@ -1673,7 +1673,8 @@ upstream_write_cb(void *userarg)
return;
default:
if (netreq->upstream->tls_obj &&
if (netreq->owner->return_call_reporting &&
netreq->upstream->tls_obj &&
(cert = SSL_get_peer_certificate(netreq->upstream->tls_obj))) {
assert(netreq->debug_tls_peer_cert.data == NULL);

View File

@ -912,7 +912,7 @@ _getdns_create_call_reporting_dict(
}
netreq->debug_tls_peer_cert.size = 0;
OPENSSL_free(netreq->debug_tls_peer_cert.data);
netreq->debug_tls_peer_cert.data = NULL;
return netreq_debug;
}