connect: remove deref of freed pointer in trace call

Spotted by CodeSonar

Closes #21649
This commit is contained in:
Daniel Stenberg 2026-05-16 23:59:05 +02:00
parent d74c0ada4e
commit e8c1023b00
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -389,10 +389,13 @@ connect_sub_chain:
cf->conn->socks_proxy.proxytype,
cf->conn->socks_proxy.creds);
if(result) {
/* 'dest' might be freed now so it can't be dereferenced */
CURL_TRC_CF(data, cf, "added SOCKS filter failed -> %d", result);
return result;
}
CURL_TRC_CF(data, cf, "added SOCKS filter to %s:%u -> %d",
dest->hostname, dest->port, result);
if(result)
return result;
ctx->state = CF_SETUP_CNNCT_SOCKS;
if(!cf->next || !cf->next->connected)
goto connect_sub_chain;