fix memory leak

v1
Brett 2023-10-27 14:32:15 -04:00
parent 585429e345
commit 1d8f9b4bbd
1 changed files with 2 additions and 0 deletions

View File

@ -186,6 +186,7 @@ namespace blt
scoped_buffer(scoped_buffer&& move) noexcept scoped_buffer(scoped_buffer&& move) noexcept
{ {
delete[] _buffer;
_buffer = move._buffer; _buffer = move._buffer;
_size = move.size(); _size = move.size();
move._buffer = nullptr; move._buffer = nullptr;
@ -195,6 +196,7 @@ namespace blt
scoped_buffer& operator=(scoped_buffer&& moveAssignment) noexcept scoped_buffer& operator=(scoped_buffer&& moveAssignment) noexcept
{ {
delete[] _buffer;
_buffer = moveAssignment._buffer; _buffer = moveAssignment._buffer;
_size = moveAssignment.size(); _size = moveAssignment.size();
moveAssignment._buffer = nullptr; moveAssignment._buffer = nullptr;