diff --git a/AK/FixedArray.h b/AK/FixedArray.h index b32ccd2e84..c2d22512ca 100644 --- a/AK/FixedArray.h +++ b/AK/FixedArray.h @@ -20,7 +20,7 @@ public: : m_size(size) { if (m_size != 0) { - m_elements = (T*)kmalloc(sizeof(T) * m_size); + m_elements = static_cast(kmalloc_array(m_size, sizeof(T))); for (size_t i = 0; i < m_size; ++i) new (&m_elements[i]) T(); } @@ -34,7 +34,7 @@ public: : m_size(other.m_size) { if (m_size != 0) { - m_elements = (T*)kmalloc(sizeof(T) * m_size); + m_elements = static_cast(kmalloc_array(m_size, sizeof(T))); for (size_t i = 0; i < m_size; ++i) new (&m_elements[i]) T(other[i]); } diff --git a/AK/Vector.h b/AK/Vector.h index 88d1348e84..f13fb1198a 100644 --- a/AK/Vector.h +++ b/AK/Vector.h @@ -623,7 +623,7 @@ public: if (m_capacity >= needed_capacity) return true; size_t new_capacity = kmalloc_good_size(needed_capacity * sizeof(StorageType)) / sizeof(StorageType); - auto* new_buffer = (StorageType*)kmalloc(new_capacity * sizeof(StorageType)); + auto* new_buffer = static_cast(kmalloc_array(new_capacity, sizeof(StorageType))); if (new_buffer == nullptr) return false;