mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-27 17:52:43 +00:00
MFC r300665
Don't leak addrinfo in fetch_bind() Submitted by: Coverity CID: 1225038
This commit is contained in:
parent
15fe2c59b0
commit
dee32aa9c8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/stable/10/; revision=301153
@ -256,8 +256,11 @@ fetch_bind(int sd, int af, const char *addr)
|
|||||||
if ((err = getaddrinfo(addr, NULL, &hints, &res0)) != 0)
|
if ((err = getaddrinfo(addr, NULL, &hints, &res0)) != 0)
|
||||||
return (-1);
|
return (-1);
|
||||||
for (res = res0; res; res = res->ai_next)
|
for (res = res0; res; res = res->ai_next)
|
||||||
if (bind(sd, res->ai_addr, res->ai_addrlen) == 0)
|
if (bind(sd, res->ai_addr, res->ai_addrlen) == 0) {
|
||||||
|
freeaddrinfo(res0);
|
||||||
return (0);
|
return (0);
|
||||||
|
}
|
||||||
|
freeaddrinfo(res0);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user