mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-28 21:54:40 +03:00
AK: Use kfree_sized() in AK::ByteBuffer
This commit is contained in:
parent
6950dd220b
commit
05a00c3978
Notes:
sideshowbarker
2024-07-18 09:20:19 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/05a00c39781
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user