mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 01:41:59 -05:00
LibCore: Null-check struct addrinfo to avoid freeaddrinfo(NULL)
On some C libraries, like NetBSD and musl-libc, this under-specified edge case results in a crash rather than silently ignoring the null pointer.
This commit is contained in:
parent
605aa2e34b
commit
3bb41e942f
1 changed files with 5 additions and 1 deletions
|
@ -264,7 +264,11 @@ private:
|
|||
}
|
||||
|
||||
struct AddrInfoDeleter {
|
||||
void operator()(struct addrinfo* ptr) { ::freeaddrinfo(ptr); }
|
||||
void operator()(struct addrinfo* ptr)
|
||||
{
|
||||
if (ptr)
|
||||
::freeaddrinfo(ptr);
|
||||
}
|
||||
};
|
||||
|
||||
Vector<struct addrinfo> m_addresses {};
|
||||
|
|
Loading…
Reference in a new issue