Fix crash issue when getting the locale was failed 57/125957/2
authorjongmyeongko <jongmyeong.ko@samsung.com>
Wed, 19 Apr 2017 11:20:24 +0000 (20:20 +0900)
committerjongmyeong ko <jongmyeong.ko@samsung.com>
Thu, 20 Apr 2017 02:34:10 +0000 (19:34 -0700)
Change-Id: Ic115f69df765d454288ad8259d959992297387fe
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
src/lib/tpk_archive_info.cc

index a010f58ad3b118146a81d6fd8ba5ae26a751be77..e3b9a53ed5bcd621ad9a02650ce4e175c88057bf 100644 (file)
@@ -35,7 +35,7 @@ namespace ci = common_installer;
 
 namespace {
 
-const char kVconfLanguageKey[] = "db/menu_widget/language";
+const char kVconfLanguageKey[] = VCONFKEY_LANGSET;
 const char kManifestFileName[] = "tizen-manifest.xml";
 const char kSharedResDir[] = "shared/res";
 
@@ -300,12 +300,15 @@ bool TpkArchiveInfo::GetArchiveInfo(const char* file_path,
     LOG(WARNING) << "Failed to get privilege info";
 
   char* locale = vconf_get_str(kVconfLanguageKey);
+  if (!locale)
+    locale = strdup("");
   LOG(INFO) << "Current locale: " << locale;
   if (!GetLabelInfo(parser, locale, info))
     LOG(WARNING) << "Failed to get label info";
   if (!GetDescriptionInfo(parser, locale, info))
     LOG(WARNING) << "Failed to get description info";
   std::string icon = GetIconInfo(parser, locale);
+  free(locale);
   if (!icon.empty()) {
     bf::path icon_path = bf::path(kSharedResDir) / icon;
     if (!ExtractPackageArchive(
@@ -320,7 +323,6 @@ bool TpkArchiveInfo::GetArchiveInfo(const char* file_path,
     }
   }
 
-  free(locale);
   ci::RemoveAll(tmp_dir);
 
   return true;