From 1bddfe02d5b3d728a01a85ee588696310876f0d9 Mon Sep 17 00:00:00 2001 From: x2018 Date: Sun, 9 Nov 2025 00:37:16 +0800 Subject: [PATCH] asyn-thrdd: release rrname if ares_init_options fails Closes #19410 --- lib/asyn-thrdd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/asyn-thrdd.c b/lib/asyn-thrdd.c index b25745ee1b..2ee4629890 100644 --- a/lib/asyn-thrdd.c +++ b/lib/asyn-thrdd.c @@ -376,14 +376,17 @@ static CURLcode async_rr_start(struct Curl_easy *data, int port) status = ares_init_options(&thrdd->rr.channel, NULL, 0); if(status != ARES_SUCCESS) { thrdd->rr.channel = NULL; + free(rrname); return CURLE_FAILED_INIT; } #ifdef CURLDEBUG if(getenv("CURL_DNS_SERVER")) { const char *servers = getenv("CURL_DNS_SERVER"); status = ares_set_servers_ports_csv(thrdd->rr.channel, servers); - if(status) + if(status) { + free(rrname); return CURLE_FAILED_INIT; + } } #endif