Create manifest_x in parse steps 38/50538/5
authorTomasz Iwanek <t.iwanek@samsung.com>
Thu, 29 Oct 2015 13:43:31 +0000 (14:43 +0100)
committerPawel Sikorski <p.sikorski@samsung.com>
Fri, 30 Oct 2015 15:11:12 +0000 (08:11 -0700)
Change-Id: I458fa86e48d1511df365152f30f580767ad25d19

src/common/installer_context.cc
src/tpk/step/step_parse.cc
src/wgt/step/step_parse.cc

index e7f8dda..50554b8 100644 (file)
@@ -31,7 +31,7 @@ const char* PrivilegeLevelToString(PrivilegeLevel level) {
 }
 
 InstallerContext::InstallerContext()
-    : manifest_data(static_cast<manifest_x*>(calloc(1, sizeof(manifest_x)))),
+    : manifest_data(nullptr),
       old_manifest_data(nullptr),
       uid(getuid()),
       backend_data(nullptr),
index 806bc01..cec786c 100644 (file)
@@ -397,7 +397,8 @@ common_installer::Step::Status StepParse::process() {
     return common_installer::Step::Status::ERROR;
   }
 
-  const manifest_x* manifest = context_->manifest_data.get();
+  manifest_x* manifest =
+      static_cast<manifest_x*>(calloc(1, sizeof(manifest_x)));
   if (!FillManifestX(const_cast<manifest_x*>(manifest))) {
     LOG(ERROR) << "[Parse] Storing manifest_x failed. "
                <<  parser_->GetErrorMessage();
@@ -447,6 +448,7 @@ common_installer::Step::Status StepParse::process() {
   LOG(DEBUG) << "  ]-";
   LOG(DEBUG) << "]-";
 
+  context_->manifest_data.set(manifest);
   return common_installer::Step::Status::OK;
 }
 
index e0bfe2c..48769b0 100755 (executable)
@@ -386,7 +386,8 @@ common_installer::Step::Status StepParse::process() {
     }
   }
 
-  manifest_x* manifest = context_->manifest_data.get();
+  manifest_x* manifest =
+      static_cast<manifest_x*>(calloc(1, sizeof(manifest_x)));
   if (!FillManifestX(manifest)) {
     LOG(ERROR) << "[Parse] Storing manifest_x failed. "
                <<  parser_->GetErrorMessage();
@@ -420,8 +421,7 @@ common_installer::Step::Status StepParse::process() {
   const std::string& package_version = wgt_info->version();
   const std::string& required_api_version = info->required_version();
 
-  context_->manifest_data.get()->api_version =
-      strdup(required_api_version.c_str());
+  manifest->api_version = strdup(required_api_version.c_str());
   context_->pkgid.set(manifest->package);
 
   // write pkgid for recovery file
@@ -465,6 +465,7 @@ common_installer::Step::Status StepParse::process() {
   LOG(DEBUG) << "  ]-";
   LOG(DEBUG) << "]-";
 
+  context_->manifest_data.set(manifest);
   return common_installer::Step::Status::OK;
 }