From 6459c5a713da6fab14a601620c0e1676b5178f98 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Sun, 23 May 2021 13:39:19 -0600 Subject: [PATCH] AK: Explicitly initialize buffer member in ByteBuffer When compiling the Kernel with Og, the compiler complains that m_outline_capacity might be uninitialized when calling capacity() Note that this fix is not really what we want. Ideally only outline buffer and outline capacity would need initialized, not the entire inline buffer. However, clang considers the class to not be default-constructible if we make that change, while gcc accepts it. --- AK/ByteBuffer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AK/ByteBuffer.h b/AK/ByteBuffer.h index 89314f8eb8..124702596e 100644 --- a/AK/ByteBuffer.h +++ b/AK/ByteBuffer.h @@ -235,7 +235,7 @@ private: size_t m_size { 0 }; union { - u8 m_inline_buffer[inline_capacity]; + u8 m_inline_buffer[inline_capacity] {}; struct { u8* m_outline_buffer; size_t m_outline_capacity;