From: Joohyun Kim Date: Tue, 30 Apr 2013 02:51:47 +0000 (+0900) Subject: Fix memory leak and unique_ptr use X-Git-Tag: submit/tizen_2.1/20130514.054102~41 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cf912c714805cf83eed26c51993a948729ef3d5d;p=framework%2Fosp%2Fappfw.git Fix memory leak and unique_ptr use Change-Id: I22b9ad15f0e6a06f79138370ad2075f042a11d9c Signed-off-by: Joohyun Kim --- diff --git a/src/system/FSys_DeviceEventListenerContainer.cpp b/src/system/FSys_DeviceEventListenerContainer.cpp index f58eac0..9cfb72d 100644 --- a/src/system/FSys_DeviceEventListenerContainer.cpp +++ b/src/system/FSys_DeviceEventListenerContainer.cpp @@ -43,6 +43,10 @@ _DeviceEventListenerContainer::_DeviceEventListenerContainer(void) _DeviceEventListenerContainer::~_DeviceEventListenerContainer(void) { + if(__pEvent != null) + { + delete __pEvent; + } } bool diff --git a/src/system/FSys_SettingClient.cpp b/src/system/FSys_SettingClient.cpp index 8f3c473..60fa5e7 100644 --- a/src/system/FSys_SettingClient.cpp +++ b/src/system/FSys_SettingClient.cpp @@ -538,7 +538,7 @@ _SettingClient::GetOnService(String commandId, String key, String& response) unique_ptr 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 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 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 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); diff --git a/src/system/FSys_SystemClient.cpp b/src/system/FSys_SystemClient.cpp index 962a30e..6d1885b 100644 --- a/src/system/FSys_SystemClient.cpp +++ b/src/system/FSys_SystemClient.cpp @@ -114,7 +114,7 @@ _SystemClient::GetValue(const String& key, bool& value) unique_ptr 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 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 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);