AK: Use kfree_sized() in AK::Bitmap

This commit is contained in:
Andreas Kling 2021-07-11 13:22:27 +02:00
parent 875afb35c3
commit 6950dd220b
Notes: sideshowbarker 2024-07-18 09:20:21 +09:00

View File

@ -49,7 +49,7 @@ public:
Bitmap& operator=(Bitmap&& other) Bitmap& operator=(Bitmap&& other)
{ {
if (this != &other) { if (this != &other) {
kfree(m_data); kfree_sized(m_data, size_in_bytes());
m_data = exchange(other.m_data, nullptr); m_data = exchange(other.m_data, nullptr);
m_size = exchange(other.m_size, 0); m_size = exchange(other.m_size, 0);
} }
@ -59,7 +59,7 @@ public:
~Bitmap() ~Bitmap()
{ {
if (m_is_owning) { if (m_is_owning) {
kfree(m_data); kfree_sized(m_data, size_in_bytes());
} }
m_data = nullptr; m_data = nullptr;
} }
@ -107,7 +107,7 @@ public:
__builtin_memcpy(m_data, previous_data, previous_size_bytes); __builtin_memcpy(m_data, previous_data, previous_size_bytes);
if (previous_size % 8) if (previous_size % 8)
set_range(previous_size, 8 - previous_size % 8, default_value); set_range(previous_size, 8 - previous_size % 8, default_value);
kfree(previous_data); kfree_sized(previous_data, previous_size_bytes);
} }
} }