From 05a00c397815c412cc42f1605051587ba091e7a5 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 11 Jul 2021 13:22:40 +0200 Subject: [PATCH] AK: Use kfree_sized() in AK::ByteBuffer --- AK/ByteBuffer.h | 7 ++++--- 1 file 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; }