mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-20 08:18:55 +00: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
b5a60c0f9f
commit
2770b7eecd
Notes:
sideshowbarker
2024-07-17 04:01:41 +09:00
Author: https://github.com/ADKaster
Commit: 2770b7eecd
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/82
1 changed files with 5 additions and 1 deletions
|
@ -264,7 +264,11 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
struct AddrInfoDeleter {
|
struct AddrInfoDeleter {
|
||||||
void operator()(struct addrinfo* ptr) { ::freeaddrinfo(ptr); }
|
void operator()(struct addrinfo* ptr)
|
||||||
|
{
|
||||||
|
if (ptr)
|
||||||
|
::freeaddrinfo(ptr);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Vector<struct addrinfo> m_addresses {};
|
Vector<struct addrinfo> m_addresses {};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue