Fix memory leak and unique_ptr use
authorJoohyun Kim <joohyune.kim@samsung.com>
Tue, 30 Apr 2013 02:51:47 +0000 (11:51 +0900)
committerGerrit Code Review <gerrit2@kim11>
Tue, 30 Apr 2013 02:53:47 +0000 (11:53 +0900)
Change-Id: I22b9ad15f0e6a06f79138370ad2075f042a11d9c
Signed-off-by: Joohyun Kim <joohyune.kim@samsung.com>
src/system/FSys_DeviceEventListenerContainer.cpp
src/system/FSys_SettingClient.cpp
src/system/FSys_SystemClient.cpp

index f58eac0..9cfb72d 100644 (file)
@@ -43,6 +43,10 @@ _DeviceEventListenerContainer::_DeviceEventListenerContainer(void)
 
 _DeviceEventListenerContainer::~_DeviceEventListenerContainer(void)
 {
+       if(__pEvent != null)
+       {
+               delete __pEvent;
+       }
 }
 
 bool
index 8f3c473..60fa5e7 100644 (file)
@@ -538,7 +538,7 @@ _SettingClient::GetOnService(String commandId, String key, String& response)
 
        unique_ptr<IoService_Request> pMsg(new (std::nothrow) IoService_Request(requestMessages, &responseMessages));
 
-       r = __pIpcClient->SendRequest(*pMsg);
+       r = __pIpcClient->SendRequest(*(pMsg.get()));
        SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to send request by IPC [%s]", GetErrorMessage(r));
 
        String* pResult = (String*)responseMessages.GetAt(2);
@@ -573,7 +573,7 @@ _SettingClient::SetOnService(String commandId, String key, String& value)
        requestMessages.Add(value);
 
        unique_ptr<IoService_Request> pMsg(new (std::nothrow) IoService_Request(requestMessages, &responseMessages));
-       r = __pIpcClient->SendRequest(*pMsg);
+       r = __pIpcClient->SendRequest(*(pMsg.get()));
        SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to send request by IPC [%s]", GetErrorMessage(r));
 
        String* pResult = (String*)responseMessages.GetAt(2);
@@ -980,7 +980,7 @@ _SettingClient::SubscribeEvent(void)
 
                        unique_ptr<IoService_Request> pMsg(new (std::nothrow) IoService_Request(requestMessages, &responseMessages));
 
-                       r = __pIpcClient->SendRequest(*pMsg);
+                       r = __pIpcClient->SendRequest(*(pMsg.get()));
                        SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to send request by IPC [%s]", GetErrorMessage(r));
 
                        String* pResult = (String*)responseMessages.GetAt(2);
@@ -1011,7 +1011,7 @@ _SettingClient::SubscribeEvent(void)
 
                        unique_ptr<IoService_Request> pMsg(new (std::nothrow) IoService_Request(requestMessages, &responseMessages));
 
-                       r = __pIpcClient->SendRequest(*pMsg);
+                       r = __pIpcClient->SendRequest(*(pMsg.get()));
                        SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to send request by IPC [%s]", GetErrorMessage(r));
 
                        String* pResult = (String*)responseMessages.GetAt(2);
index 962a30e..6d1885b 100644 (file)
@@ -114,7 +114,7 @@ _SystemClient::GetValue(const String& key, bool& value)
 
        unique_ptr<IoService_Request> pMsg(new (std::nothrow) IoService_Request(requestMessages, &responseMessages));
 
-       r = __pIpcClient->SendRequest(*pMsg);
+       r = __pIpcClient->SendRequest(*(pMsg.get()));
        SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to send request by IPC [%s]", GetErrorMessage(r));
 
        String* pResult = (String*)responseMessages.GetAt(2);
@@ -164,7 +164,7 @@ _SystemClient::GetValue(const String& key, int& value)
 
        unique_ptr<IoService_Request> pMsg(new (std::nothrow) IoService_Request(requestMessages, &responseMessages));
 
-       r = __pIpcClient->SendRequest(*pMsg);
+       r = __pIpcClient->SendRequest(*(pMsg.get()));
        SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to send request by IPC [%s]", GetErrorMessage(r));
 
        String* pResult = (String*)responseMessages.GetAt(2);
@@ -210,7 +210,7 @@ _SystemClient::GetValue(const String& key, String& value)
 
        unique_ptr<IoService_Request> pMsg(new (std::nothrow) IoService_Request(requestMessages, &responseMessages));
 
-       r = __pIpcClient->SendRequest(*pMsg);
+       r = __pIpcClient->SendRequest(*(pMsg.get()));
        SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to send request by IPC [%s]", GetErrorMessage(r));
 
        String* pResult = (String*)responseMessages.GetAt(2);