mirror of
https://github.com/moparisthebest/curl
synced 2025-02-28 09:21:50 -05:00
hostip: fix the memory-leak introduced in 67d2802
Fixes #5503 Closes #5504
This commit is contained in:
parent
c06ffdb6f1
commit
cba70628ae
21
lib/hostip.c
21
lib/hostip.c
@ -530,6 +530,7 @@ enum resolve_t Curl_resolv(struct connectdata *conn,
|
|||||||
return CURLRESOLV_ERROR;
|
return CURLRESOLV_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef USE_RESOLVE_ON_IPS
|
||||||
/* First check if this is an IPv4 address string */
|
/* First check if this is an IPv4 address string */
|
||||||
if(Curl_inet_pton(AF_INET, hostname, &in) > 0)
|
if(Curl_inet_pton(AF_INET, hostname, &in) > 0)
|
||||||
/* This is a dotted IP address 123.123.123.123-style */
|
/* This is a dotted IP address 123.123.123.123-style */
|
||||||
@ -544,14 +545,22 @@ enum resolve_t Curl_resolv(struct connectdata *conn,
|
|||||||
}
|
}
|
||||||
#endif /* ENABLE_IPV6 */
|
#endif /* ENABLE_IPV6 */
|
||||||
|
|
||||||
#ifdef USE_RESOLVE_ON_IPS
|
#else /* if USE_RESOLVE_ON_IPS */
|
||||||
/* If given a numerical IP, USE_RESOLVE_ON_IPS means this still needs to
|
/* First check if this is an IPv4 address string */
|
||||||
get "resolved" but not with DoH */
|
if(Curl_inet_pton(AF_INET, hostname, &in) > 0)
|
||||||
if(addr) {
|
/* This is a dotted IP address 123.123.123.123-style */
|
||||||
addr = NULL;
|
|
||||||
ipnum = TRUE;
|
ipnum = TRUE;
|
||||||
|
#ifdef ENABLE_IPV6
|
||||||
|
else {
|
||||||
|
struct in6_addr in6;
|
||||||
|
/* check if this is an IPv6 address string */
|
||||||
|
if(Curl_inet_pton(AF_INET6, hostname, &in6) > 0)
|
||||||
|
/* This is an IPv6 address literal */
|
||||||
|
ipnum = TRUE;
|
||||||
}
|
}
|
||||||
#endif /* USE_RESOLVE_ON_IPS */
|
#endif /* ENABLE_IPV6 */
|
||||||
|
|
||||||
|
#endif /* !USE_RESOLVE_ON_IPS */
|
||||||
|
|
||||||
if(!addr) {
|
if(!addr) {
|
||||||
/* Check what IP specifics the app has requested and if we can provide
|
/* Check what IP specifics the app has requested and if we can provide
|
||||||
|
Loading…
x
Reference in New Issue
Block a user