From 282d173f23746fa6661784facdc231e2ed76bc80 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Mon, 28 Apr 2025 11:54:50 +0200 Subject: [PATCH] MT#59962 AmSessionContainer: move session ptr into try statement startSessionUAC(): Move the session smart pointer into the try statement, on the same manner as done in `startSessionUAS()`. Change-Id: I34d9176fd9c740614f822083b4a3f2dcde53b0f8 --- core/AmSessionContainer.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/AmSessionContainer.cpp b/core/AmSessionContainer.cpp index 6d681b3b..c97ce824 100644 --- a/core/AmSessionContainer.cpp +++ b/core/AmSessionContainer.cpp @@ -207,15 +207,15 @@ void AmSessionContainer::destroySession(AmSession* s) string AmSessionContainer::startSessionUAC(const AmSipRequest& req, string& app_name, const AmArg* session_params) { - unique_ptr session; - try { + unique_ptr session; + session.reset(createSession(req, app_name, session_params)); if (session.get() != 0) { session->dlg->initFromLocalRequest(req); session->setCallgroup(req.from_tag); - + switch(addSession(req.from_tag,session.get())) { case AmSessionContainer::Inserted: @@ -257,6 +257,8 @@ string AmSessionContainer::startSessionUAC(const AmSipRequest& req, string& app_ AmEventDispatcher::instance()->delEventQueue(req.from_tag); throw; } + + session.release(); } } catch(const AmSession::Exception& e){ @@ -272,7 +274,6 @@ string AmSessionContainer::startSessionUAC(const AmSipRequest& req, string& app_ return ""; } - session.release(); return req.from_tag; }