mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:11:45 +03:00
socks: ensure DNS is freed in failure cases.
In several error cases in socks.c the DNS struct is not freed, which leads to memory leaks. Found by: OSS-Fuzz: 447858136 Closes #20813
This commit is contained in:
parent
38ee35353c
commit
70ec11358c
1 changed files with 3 additions and 0 deletions
|
|
@ -341,6 +341,8 @@ static CURLproxycode socks4_resolving(struct socks_state *sx,
|
|||
|
||||
if(result || !dns) {
|
||||
failf(data, "Failed to resolve \"%s\" for SOCKS4 connect.", sx->hostname);
|
||||
if(dns)
|
||||
Curl_resolv_unlink(data, &dns);
|
||||
return CURLPX_RESOLVE_HOST;
|
||||
}
|
||||
|
||||
|
|
@ -371,6 +373,7 @@ static CURLproxycode socks4_resolving(struct socks_state *sx,
|
|||
return CURLPX_SEND_REQUEST;
|
||||
}
|
||||
else {
|
||||
Curl_resolv_unlink(data, &dns);
|
||||
failf(data, "SOCKS4 connection to %s not supported", sx->hostname);
|
||||
return CURLPX_RESOLVE_HOST;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue