]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
asyn-thrdd: release rrname if ares_init_options fails
authorx2018 <xkernel.wang@foxmail.com>
Sat, 8 Nov 2025 16:37:16 +0000 (00:37 +0800)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 9 Nov 2025 10:35:04 +0000 (11:35 +0100)
Closes #19410

lib/asyn-thrdd.c

index b25745ee1b3b44395e05c225529aedaedbec49da..2ee4629890036110640e8de9ce69fe0e63a25e7f 100644 (file)
@@ -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