From 6bb7c803650e739fcc25986b7eb29698b7a531cd Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Fri, 14 Jun 2019 15:05:40 +0300 Subject: [PATCH] VM: Fix leaking PhysicalPage instances. After PhysicalPage::return_to_freelist(), an actual physical page is returned back to the memory manager; which will create a new PhysicalPage instance if it decides to reuse the physical page. This means this PhysicalPage instance should be freed; otherwise it would get leaked. --- Kernel/VM/PhysicalPage.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Kernel/VM/PhysicalPage.h b/Kernel/VM/PhysicalPage.h index 5ac8ad7aac..422cdbe03f 100644 --- a/Kernel/VM/PhysicalPage.h +++ b/Kernel/VM/PhysicalPage.h @@ -24,8 +24,7 @@ public: if (!--m_retain_count) { if (m_may_return_to_freelist) move(*this).return_to_freelist(); - else - delete this; + delete this; } }