From be872392f349e30b063f2830af376b4d25febb09 Mon Sep 17 00:00:00 2001 From: jongmyeongko Date: Wed, 19 Apr 2017 20:20:24 +0900 Subject: [PATCH] Fix crash issue when getting the locale was failed Change-Id: Ic115f69df765d454288ad8259d959992297387fe Signed-off-by: jongmyeongko --- src/lib/tpk_archive_info.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/tpk_archive_info.cc b/src/lib/tpk_archive_info.cc index a010f58..e3b9a53 100644 --- a/src/lib/tpk_archive_info.cc +++ b/src/lib/tpk_archive_info.cc @@ -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; -- 2.34.1