From: x2018 Date: Sun, 9 Nov 2025 16:24:10 +0000 (+0800) Subject: rustls: fix a potential memory issue X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3f1a8dbb983ebc60062bbf44a25b9c51bfacd648;p=thirdparty%2Fcurl.git rustls: fix a potential memory issue Closes #19425 --- diff --git a/lib/vtls/rustls.c b/lib/vtls/rustls.c index 262f016f9f..ab22909278 100644 --- a/lib/vtls/rustls.c +++ b/lib/vtls/rustls.c @@ -1098,8 +1098,6 @@ cr_init_backend(struct Curl_cfilter *cf, struct Curl_easy *data, &backend->config); if(rr != RUSTLS_RESULT_OK) { rustls_failf(data, rr, "failed to build client config"); - rustls_client_config_builder_free(config_builder); - rustls_client_config_free(backend->config); return CURLE_SSL_CONNECT_ERROR; } @@ -1109,6 +1107,8 @@ cr_init_backend(struct Curl_cfilter *cf, struct Curl_easy *data, &rconn); if(rr != RUSTLS_RESULT_OK) { rustls_failf(data, rr, "rustls_client_connection_new"); + rustls_client_config_free(backend->config); + backend->config = NULL; return CURLE_COULDNT_CONNECT; } DEBUGASSERT(rconn);