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
master
Donat Zenichev 1 month ago
parent 197c5c624f
commit 282d173f23

@ -207,15 +207,15 @@ void AmSessionContainer::destroySession(AmSession* s)
string AmSessionContainer::startSessionUAC(const AmSipRequest& req, string& app_name, const AmArg* session_params)
{
unique_ptr<AmSession> session;
try {
unique_ptr<AmSession> 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;
}

Loading…
Cancel
Save