From: jongmyeongko Date: Wed, 19 Apr 2017 11:20:24 +0000 (+0900) Subject: Fix crash issue when getting the locale was failed X-Git-Tag: submit/tizen/20170421.005321~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=be872392f349e30b063f2830af376b4d25febb09;p=platform%2Fcore%2Fappfw%2Ftpk-backend.git Fix crash issue when getting the locale was failed Change-Id: Ic115f69df765d454288ad8259d959992297387fe Signed-off-by: jongmyeongko --- 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;