From 6b7fe4c8f27fc6ad4e454269c43ba0de703b8919 Mon Sep 17 00:00:00 2001 From: Norman Heino Date: Sun, 26 May 2019 17:18:42 +0200 Subject: [PATCH] Fix use-after-free in Profile::UnloadMachineData --- oscar/SleepLib/profiles.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/oscar/SleepLib/profiles.cpp b/oscar/SleepLib/profiles.cpp index bf5c3c15..48e7178d 100644 --- a/oscar/SleepLib/profiles.cpp +++ b/oscar/SleepLib/profiles.cpp @@ -581,16 +581,17 @@ void Profile::UnloadMachineData() return; } - for (auto & day : daylist) { - delete day; - } - daylist.clear(); - for (auto & mach : m_machlist) { mach->saveSessionInfo(); mach->sessionlist.clear(); mach->day.clear(); } + + for (auto & day : daylist) { + delete day; + } + daylist.clear(); + removeLock(); } void Profile::LoadMachineData(ProgressDialog *progress)