From 106599895d56236e22fb59bb69d4479ecc992e18 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Fri, 8 Apr 2022 11:02:17 -0700 Subject: [PATCH] fs: fix memory leak when path is reallocated (closes #1842) --- libraries/libstratosphere/include/stratosphere/fs/fs_path.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_path.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_path.hpp index 8bc0c0f93..c2bb12cd0 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fs_path.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fs_path.hpp @@ -54,6 +54,10 @@ namespace ams::fs { } constexpr WriteBuffer &operator=(WriteBuffer &&rhs) { + if (m_buffer != nullptr) { + ::ams::fs::impl::Deallocate(m_buffer, this->GetLength()); + } + m_buffer = rhs.m_buffer; m_length_and_is_normalized = rhs.m_length_and_is_normalized;