mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 09:39:39 +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: bfd4c7a16c
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;
|
return;
|
||||||
}
|
}
|
||||||
u8* new_data = static_cast<u8*>(kmalloc(size));
|
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;
|
u8* old_data = m_data;
|
||||||
m_data = new_data;
|
m_data = new_data;
|
||||||
m_size = size;
|
m_size = size;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue