prevent issue.
authorByounghui <byounghui.lim@samsung.com>
Tue, 13 Aug 2013 04:36:59 +0000 (13:36 +0900)
committerByounghui <byounghui.lim@samsung.com>
Tue, 13 Aug 2013 05:00:57 +0000 (14:00 +0900)
Change-Id: I50d37a9e0820c6e0f23e1c8ada29b78e54e00df0
Signed-off-by: Byounghui <byounghui.lim@samsung.com>
src/messaging/FMsg_IpcCallbackHandler.cpp

index 8e8b991..2cad58a 100644 (file)
@@ -786,19 +786,26 @@ _IpcCallbackHandler::SetWapPushClientId(const Tizen::Base::String& AppId, int id
        if(!__pWapPushClientId)
        {
                __pWapPushClientId = new (std::nothrow) Tizen::Base::Collection::MultiHashMap();
-               SysTryReturnResult(NID_MSG, __pWapPushClientId != null, E_OUT_OF_MEMORY, "memory allocation failed.");
-               __pWapPushClientId->Construct();
-
+               SysTryCatch(NID_MSG, __pWapPushClientId != null, ,E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] memory allocation failed.");
+               r = __pWapPushClientId->Construct();
+               SysTryCatch(NID_MSG, r == E_SUCCESS, delete __pWapPushClientId , r, "[%s] Contruct of MultiHashMap Failed.", GetErrorMessage(r));
        }
        if(!__pWapPushClientId->Contains(*pId, *pApp))
        {
                r = __pWapPushClientId->Add(*pId, *pApp);
-               SysLog(NID_MSG, "AppId %ls, Client %d",AppId.GetPointer(), id);         
+               SysLog(NID_MSG, "AppId %ls, Client %d",AppId.GetPointer(), id);
                return r;
        }
+
+       delete pId;
+       delete pApp;
+       return r;
+
+CATCH:
        delete pId;
        delete pApp;
        return r;
+
 }
 
 result
@@ -812,16 +819,23 @@ _IpcCallbackHandler::SetSmsClientId (int port,  int id)
        if(!__pSmsClientId)
        {
                __pSmsClientId = new (std::nothrow) Tizen::Base::Collection::MultiHashMap();
-               SysTryReturnResult(NID_MSG, __pSmsClientId != null, E_OUT_OF_MEMORY, "memory allocation failed.");
-               __pSmsClientId->Construct();
+               SysTryCatch(NID_MSG, __pSmsClientId != null, ,E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] memory allocation failed.");
+               r = __pSmsClientId->Construct();
+               SysTryCatch(NID_MSG, r == E_SUCCESS, delete __pSmsClientId , r, "[%s] Contruct of MultiHashMap Failed.", GetErrorMessage(r));
 
        }
        if(!__pSmsClientId->Contains(*pId, *pPort))
        {
                r = __pSmsClientId->Add(*pId, *pPort);
-               SysLog(NID_MSG, "Port %ls, Client %d",pPort->GetPointer(), id);         
+               SysLog(NID_MSG, "Port %ls, Client %d",pPort->GetPointer(), id);
                return r;
        }
+
+       delete pId;
+       delete pPort;
+       return r;
+
+CATCH:
        delete pId;
        delete pPort;
        return r;
@@ -837,8 +851,9 @@ _IpcCallbackHandler::SetCbsEtwsClientId ( int id)
        if(!__pCbsEtwsClientId)
        {
                __pCbsEtwsClientId = new (std::nothrow) Tizen::Base::Collection::ArrayList();
-               SysTryReturnResult(NID_MSG, __pCbsEtwsClientId != null, E_OUT_OF_MEMORY, "memory allocation failed.");
-               __pCbsEtwsClientId->Construct();
+               SysTryCatch(NID_MSG, __pCbsEtwsClientId != null, ,E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] memory allocation failed.");
+               r = __pCbsEtwsClientId->Construct();
+               SysTryCatch(NID_MSG, r == E_SUCCESS, delete __pCbsEtwsClientId , r, "[%s] Contruct of ArrayList Failed.", GetErrorMessage(r));
 
        }
        if(!__pCbsEtwsClientId->Contains(*pId))
@@ -849,6 +864,11 @@ _IpcCallbackHandler::SetCbsEtwsClientId ( int id)
        }
        delete pId;
        return r;
+
+CATCH:
+       delete pId;
+       return r;
+
 }
 
 result