mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 03:55:24 +00:00
AK: Avoid passing nullptr to __buitin_memcpy() in ByteBuffer::grow()
This commit is contained in:
parent
a4e20a87d5
commit
bfd4c7a16c
Notes:
sideshowbarker
2024-07-18 18:10:59 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/bfd4c7a16cd Pull-request: https://github.com/SerenityOS/serenity/pull/7093 Issue: https://github.com/SerenityOS/serenity/issues/7072
1 changed files with 2 additions and 1 deletions
|
@ -277,7 +277,8 @@ inline void ByteBufferImpl::grow(size_t size)
|
|||
return;
|
||||
}
|
||||
u8* new_data = static_cast<u8*>(kmalloc(size));
|
||||
__builtin_memcpy(new_data, m_data, m_size);
|
||||
if (m_data)
|
||||
__builtin_memcpy(new_data, m_data, m_size);
|
||||
u8* old_data = m_data;
|
||||
m_data = new_data;
|
||||
m_size = size;
|
||||
|
|
Loading…
Add table
Reference in a new issue