From ea964e5d15055148e58835687d6af8df0f913526 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 12 Mar 2025 10:52:20 -0400 Subject: [PATCH] MT#59962 DSM: use smart pointer Fixes a possible leak. Change-Id: Iace78241f5a32ab7d328b2dbdf7498e935fcf90f Warned-by: Coverity --- apps/dsm/DSM.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/dsm/DSM.cpp b/apps/dsm/DSM.cpp index 971d31ef..a437e244 100644 --- a/apps/dsm/DSM.cpp +++ b/apps/dsm/DSM.cpp @@ -831,7 +831,7 @@ bool DSMFactory::createSystemDSM(const string& config_name, const string& start_ } void DSMFactory::reloadDSMs(const AmArg& args, AmArg& ret) { - DSMStateDiagramCollection* new_diags = new DSMStateDiagramCollection(); + auto new_diags = std::make_unique(); AmConfigReader cfg; if(cfg.loadFile(AmConfig::ModConfigPath + string(MOD_NAME ".conf"))) { @@ -861,7 +861,7 @@ void DSMFactory::reloadDSMs(const AmArg& args, AmArg& ret) { } ScriptConfigs_mut.lock(); old_diags.insert(MainScriptConfig.diags); - MainScriptConfig.diags = new_diags; + MainScriptConfig.diags = new_diags.release(); ScriptConfigs_mut.unlock(); ret.push(200);