AK: Avoid passing nullptr to __buitin_memcpy() in ByteBuffer::grow()

This commit is contained in:
Ali Mohammad Pur 2021-05-14 09:22:01 +04:30 committed by Linus Groh
parent a4e20a87d5
commit bfd4c7a16c

View file

@ -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;