From e7c380b364db2f12966a8a2b4d042265ceb05c45 Mon Sep 17 00:00:00 2001 From: "salt.wei" Date: Mon, 18 Sep 2023 10:24:29 +0800 Subject: [PATCH] FIX: fix memleak related to config clone JIRA: none, found by self test Signed-off-by: salt.wei Change-Id: Ifbab17d543c60a767c0a53e1bca7dfe77bd8fbec --- src/libslic3r/Config.cpp | 1 + src/slic3r/GUI/ProjectDirtyStateManager.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/libslic3r/Config.cpp b/src/libslic3r/Config.cpp index 69630c16a..a290532a2 100644 --- a/src/libslic3r/Config.cpp +++ b/src/libslic3r/Config.cpp @@ -308,6 +308,7 @@ ConfigOption* ConfigOptionDef::create_default_option() const opt->keys_map = this->enum_keys_map; return opt; } + delete dft; } return this->default_value->clone(); diff --git a/src/slic3r/GUI/ProjectDirtyStateManager.cpp b/src/slic3r/GUI/ProjectDirtyStateManager.cpp index 5d32ca348..c6a23723d 100644 --- a/src/slic3r/GUI/ProjectDirtyStateManager.cpp +++ b/src/slic3r/GUI/ProjectDirtyStateManager.cpp @@ -35,6 +35,7 @@ void ProjectDirtyStateManager::update_from_presets() if (ConfigOption *color_option = wxGetApp().preset_bundle->project_config.option("filament_colour")) { auto colors = static_cast(color_option->clone()); m_presets_dirty |= m_initial_filament_presets_colors != colors->values; + delete colors; } } else { m_presets_dirty |= !m_initial_presets[type].empty() && m_initial_presets[type] != name; @@ -66,6 +67,7 @@ void ProjectDirtyStateManager::reset_initial_presets() if (ConfigOption *color_option = wxGetApp().preset_bundle->project_config.option("filament_colour")) { auto colors = static_cast(color_option->clone()); m_initial_filament_presets_colors = colors->values; + delete colors; } } else { m_initial_presets[type] = name;