mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-06 08:56:40 +00:00
AK: Avoid passing nullptr to __buitin_memcpy() in ByteBuffer::grow()
This commit is contained in:
parent
a4e20a87d5
commit
bfd4c7a16c
|
@ -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…
Reference in a new issue