Remove tmpdir when failed to getting icon info 46/108846/2
authorSangyoon Jang <s89.jang@samsung.com>
Fri, 6 Jan 2017 04:51:29 +0000 (13:51 +0900)
committerjongmyeong ko <jongmyeong.ko@samsung.com>
Fri, 6 Jan 2017 06:09:44 +0000 (22:09 -0800)
Change-Id: I8b26603ac401f3eaae276da8dfe7dc4e4838aca1
Signed-off-by: Sangyoon Jang <s89.jang@samsung.com>
src/lib/wgt_archive_info.cc

index d30577c..4ae49df 100644 (file)
@@ -197,10 +197,13 @@ bool WgtArchiveInfo::GetArchiveInfo(const char* file_path,
     LOG(WARNING) << "Failed to get privileges info";
   std::string icon = GetIconInfo(parser);
   if (!icon.empty()) {
-    if (!ExtractPackageArchive(file_path, icon.c_str(), tmp_dir))
+    if (!ExtractPackageArchive(file_path, icon.c_str(), tmp_dir)) {
+      bf::remove_all(tmp_dir);
       return false;
+    }
     if (!ReadIcon(icon, tmp_dir, info)) {
       LOG(WARNING) << "Failed to get icon info";
+      bf::remove_all(tmp_dir);
       return false;
     }
   }