]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
kdig: fix double free when query times out
authorDaniel Salzman <daniel.salzman@nic.cz>
Thu, 26 Aug 2021 06:20:06 +0000 (08:20 +0200)
committerDaniel Salzman <daniel.salzman@nic.cz>
Thu, 26 Aug 2021 06:31:04 +0000 (08:31 +0200)
fixes #763

src/utils/common/https.c
src/utils/common/netio.c
src/utils/common/tls.c

index 73283a7e97d2053a620a8714c05b7aed55bd0b64..bc7912bfea29695cfa14900fdd91370dd8bd73cc 100644 (file)
@@ -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;
index 5528002f92a0f18124414ee5ca4d0c832e881e96..684989801b457245339a4ac7de75421368581a29 100644 (file)
@@ -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
index 1328927c5c7b390f70c49b966d06648aaec85702..4c50bf8494a90a8ca9484c38ce2301a6f23acbec 100644 (file)
@@ -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;
        }
 }