diff --git a/kernel/src/CppLib/Stream.cpp b/kernel/src/CppLib/Stream.cpp index 50d16d7..cd0fbb9 100644 --- a/kernel/src/CppLib/Stream.cpp +++ b/kernel/src/CppLib/Stream.cpp @@ -15,11 +15,17 @@ kcp::cstringstream::cstringstream() this->size = 0; } +kcp::cstringstream::~cstringstream() +{ + delete this->string; +} + kcp::cstringstream& kcp::cstringstream::operator<<(char c) { this->string = (const char *)Memory::g_allocator->Realloc((void *)this->string, this->size + 1); if (!this->string) { + kerr << "Streaming failed due to failed allocation" << Kt::newline; return *this; } diff --git a/kernel/src/CppLib/Stream.hpp b/kernel/src/CppLib/Stream.hpp index 8f3367c..140556e 100644 --- a/kernel/src/CppLib/Stream.hpp +++ b/kernel/src/CppLib/Stream.hpp @@ -27,6 +27,7 @@ namespace kcp { public: cstringstream(); + ~cstringstream(); cstringstream& operator<<(char c); cstringstream& operator<<(char* str);