diff options
author | Andreas Kling <kling@serenityos.org> | 2021-07-11 13:22:40 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-11 14:14:51 +0200 |
commit | 05a00c397815c412cc42f1605051587ba091e7a5 (patch) | |
tree | c1d3bcc73bdd715a57db591113780a8b8bb86b5c /AK/ByteBuffer.h | |
parent | 6950dd220bcc1ba63cc2bdab807b80de880aa352 (diff) | |
download | serenity-05a00c397815c412cc42f1605051587ba091e7a5.zip |
AK: Use kfree_sized() in AK::ByteBuffer
Diffstat (limited to 'AK/ByteBuffer.h')
-rw-r--r-- | AK/ByteBuffer.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/AK/ByteBuffer.h b/AK/ByteBuffer.h index d11e157610..5f19d2b299 100644 --- a/AK/ByteBuffer.h +++ b/AK/ByteBuffer.h @@ -41,7 +41,7 @@ public: { if (this != &other) { if (!m_inline) - kfree(m_outline_buffer); + kfree_sized(m_outline_buffer, m_outline_capacity); move_from(move(other)); } return *this; @@ -138,7 +138,7 @@ public: void clear() { if (!m_inline) { - kfree(m_outline_buffer); + kfree_sized(m_outline_buffer, m_outline_capacity); m_inline = true; } m_size = 0; @@ -230,9 +230,10 @@ private: { // m_inline_buffer and m_outline_buffer are part of a union, so save the pointer auto outline_buffer = m_outline_buffer; + auto outline_capacity = m_outline_capacity; if (!may_discard_existing_data) __builtin_memcpy(m_inline_buffer, outline_buffer, size); - kfree(outline_buffer); + kfree_sized(outline_buffer, outline_capacity); m_inline = true; } |