mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03: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: https://github.com/LadybirdBrowser/ladybird/commit/2770b7eecd Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/82
@ -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…
Reference in New Issue
Block a user