From: Daniel Salzman Date: Thu, 26 Aug 2021 06:20:06 +0000 (+0200) Subject: kdig: fix double free when query times out X-Git-Tag: v3.1.2~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e875acbdf5659ddc13bf47d50fb5ec7fbb171ec6;p=thirdparty%2Fknot-dns.git kdig: fix double free when query times out fixes #763 --- diff --git a/src/utils/common/https.c b/src/utils/common/https.c index 73283a7e97..bc7912bfea 100644 --- a/src/utils/common/https.c +++ b/src/utils/common/https.c @@ -505,6 +505,7 @@ void https_ctx_deinit(https_ctx_t *ctx) } nghttp2_session_del(ctx->session); + ctx->session = NULL; pthread_mutex_destroy(&ctx->recv_mx); free(ctx->path); ctx->path = NULL; diff --git a/src/utils/common/netio.c b/src/utils/common/netio.c index 5528002f92..684989801b 100644 --- a/src/utils/common/netio.c +++ b/src/utils/common/netio.c @@ -659,6 +659,8 @@ void net_clean(net_t *net) free(net->local_str); free(net->remote_str); + net->local_str = NULL; + net->remote_str = NULL; if (net->local_info != NULL) { if (net->local == NULL) { @@ -666,10 +668,12 @@ void net_clean(net_t *net) } else { freeaddrinfo(net->local_info); } + net->local_info = NULL; } if (net->remote_info != NULL) { freeaddrinfo(net->remote_info); + net->remote_info = NULL; } #ifdef LIBNGHTTP2 diff --git a/src/utils/common/tls.c b/src/utils/common/tls.c index 1328927c5c..4c50bf8494 100644 --- a/src/utils/common/tls.c +++ b/src/utils/common/tls.c @@ -695,6 +695,7 @@ void tls_ctx_deinit(tls_ctx_t *ctx) if (ctx->credentials != NULL) { gnutls_certificate_free_credentials(ctx->credentials); + ctx->credentials = NULL; } }