diff --git a/AK/ByteBuffer.h b/AK/ByteBuffer.h index a6a4b9fe437..f3a85f9f55c 100644 --- a/AK/ByteBuffer.h +++ b/AK/ByteBuffer.h @@ -243,8 +243,10 @@ private: new_capacity = kmalloc_good_size(new_capacity); if (!m_inline) { new_buffer = (u8*)kmalloc(new_capacity); - if (m_outline_buffer) + if (m_outline_buffer) { __builtin_memcpy(new_buffer, m_outline_buffer, min(new_capacity, m_outline_capacity)); + kfree_sized(m_outline_buffer, m_outline_capacity); + } VERIFY(new_buffer); } else { new_buffer = (u8*)kmalloc(new_capacity);