From 41be8d8c4fc4e9fb2e94844334ec89c27783126665045c7382ff31ce65f8b462 Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Tue, 12 Aug 2025 04:00:21 -0400 Subject: [PATCH] Another local string. --- src/IO/http.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/IO/http.cc b/src/IO/http.cc index 92f74e3..e0cae0a 100644 --- a/src/IO/http.cc +++ b/src/IO/http.cc @@ -796,7 +796,6 @@ static void Http_dns_cb(int Status, std::optional< std::vector< std::shared_ptr< static int Http_get(ChainLink *Info, void *Data1) { SocketData_t *S; - char *hostname; const DilloUrl *url; S = reinterpret_cast< SocketData_t * >( a_Klist_get_data(ValidSocks, VOIDP2INT(Info->LocalKey)) ); @@ -812,20 +811,19 @@ static int Http_get(ChainLink *Info, void *Data1) } else { url = S->web->url.get(); } - hostname = dStrdup(URL_HOST(url)); + const std::string hostname = URL_HOST(url); S->connect_port = URL_PORT(url); S->url = a_Url_dup(S->web->url.get()).release(); if (!dStrAsciiCasecmp(URL_SCHEME(S->url), "https")) S->flags |= HTTP_SOCKET_TLS; /* Let the user know what we'll do */ - MSG_BW(S->web, 1, "DNS resolving %s", hostname); + MSG_BW(S->web, 1, "DNS resolving %s", hostname.c_str()); /* Let the DNS engine resolve the hostname, and when done, * we'll try to connect the socket from the callback function */ - a_Dns_resolve(hostname, Http_dns_cb, Info->LocalKey); + a_Dns_resolve(hostname.c_str(), Http_dns_cb, Info->LocalKey); - dFree(hostname); return 0; }