mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-14 11:54:53 +03:00
LibC: Let malloc(0) return nullptr.
This commit is contained in:
parent
0ebaa35aa1
commit
cfa197f821
Notes:
sideshowbarker
2024-07-19 15:58:20 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/cfa197f821f
@ -42,6 +42,9 @@ static uint32_t s_malloc_sum_free = POOL_SIZE;
|
||||
|
||||
void* malloc(size_t size)
|
||||
{
|
||||
if (size == 0)
|
||||
return nullptr;
|
||||
|
||||
// We need space for the MallocHeader structure at the head of the block.
|
||||
size_t real_size = size + sizeof(MallocHeader) + sizeof(MallocFooter);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user