fix AppControl result handling with memory leak fix
authorYoung Ik Cho <youngik.cho@samsung.com>
Tue, 9 Apr 2013 03:11:07 +0000 (12:11 +0900)
committerYoung Ik Cho <youngik.cho@samsung.com>
Tue, 9 Apr 2013 03:11:07 +0000 (12:11 +0900)
Change-Id: Iceeb51c762fc5f77f0f48517929833e81276d302
Signed-off-by: Young Ik Cho <youngik.cho@samsung.com>
src/app/FApp_AppImpl.cpp
src/app/FApp_AppResourceString.cpp

index a6179bf..d942872 100644 (file)
@@ -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());
index 26cb559..ad6bab3 100644 (file)
@@ -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;
                        }
 
                }