From 7bc739561db8d6b6188630071a63c5b6f18a1ad7 Mon Sep 17 00:00:00 2001 From: Young Ik Cho Date: Tue, 9 Apr 2013 12:11:07 +0900 Subject: [PATCH] fix AppControl result handling with memory leak fix Change-Id: Iceeb51c762fc5f77f0f48517929833e81276d302 Signed-off-by: Young Ik Cho --- src/app/FApp_AppImpl.cpp | 6 ++++++ src/app/FApp_AppResourceString.cpp | 21 ++++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/app/FApp_AppImpl.cpp b/src/app/FApp_AppImpl.cpp index a6179bf..d942872 100644 --- a/src/app/FApp_AppImpl.cpp +++ b/src/app/FApp_AppImpl.cpp @@ -68,6 +68,7 @@ namespace const int HEARTBEAT_WAIT_COUNT = 3; const wchar_t SERVICE_APPID[] = L"aospd00043.osp-app-service"; const char SELECTOR_RESPONSE_KEY[] = "__APP_SVC_START_INFO__"; +const wchar_t FILE_SCHEME_WITH_DELIMITER[] = L"file://"; #ifndef VCONFKEY_APPSERVICE_STATUS #define VCONFKEY_APPSERVICE_STATUS "memory/appservice/status" #endif @@ -711,6 +712,11 @@ _AppImpl::OnAppControlRequestReceived(const _AppArg& arg, RequestId reqId) if (p) { uri = p; + if (uri[0] == L'/') + { + // SLP deals with the URI as plain /opt/.../a.jpg. + uri.Insert(FILE_SCHEME_WITH_DELIMITER, 0); + } pUri = &uri; SysLog(NID_APP, "Delivered uri is [%ls].", pUri->GetPointer()); diff --git a/src/app/FApp_AppResourceString.cpp b/src/app/FApp_AppResourceString.cpp index 26cb559..ad6bab3 100644 --- a/src/app/FApp_AppResourceString.cpp +++ b/src/app/FApp_AppResourceString.cpp @@ -162,13 +162,17 @@ CATCH: result _AppResourceString::InitializeStringInfo(String& resourceFolder) { - char* pValue = null; - int ret = runtime_info_get_value_string(RUNTIME_INFO_KEY_LANGUAGE, &pValue); + char* pVal = null; + int ret = runtime_info_get_value_string(RUNTIME_INFO_KEY_LANGUAGE, &pVal); SysTryReturnResult(NID_APP, ret == 0, E_SYSTEM, "runtime_info_get_value_string returns %d.", ret); - U_ICU_NAMESPACE::Locale icuLcl(pValue); + U_ICU_NAMESPACE::Locale icuLcl(pVal); String language(icuLcl.getISO3Language()); String country(icuLcl.getCountry()); + if (pVal) + { + free(pVal); + } String resFilename; result r = resFilename.Format(256 * 2 + 10, L"%ls-%ls.xml", language.GetPointer(), country.GetPointer()); @@ -262,6 +266,17 @@ _AppResourceString::InitializeStringInfo(String& resourceFolder) pXmlNodeMap->Add(*pKey, *pValue); pKey.release(); pValue.release(); + + if (pContent) + { + xmlFree(pContent); + } + } + + if (pxmlValue) + { + xmlFree(pxmlValue); + pxmlValue = null; } } -- 2.7.4