Fix static analysis issue 14/115114/1
authorJunghyun Yeon <jungh.yeon@samsung.com>
Thu, 16 Feb 2017 08:00:13 +0000 (17:00 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Thu, 16 Feb 2017 09:51:13 +0000 (18:51 +0900)
Change-Id: I64a069b552e49149e261eb0f49495e82f970d44e
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/common/step/filesystem/step_update_tep.cc
src/common/utils/manifest_util.cc
src/common/utils/property.h

index e0fe86f..64bc845 100644 (file)
@@ -38,6 +38,8 @@ Step::Status StepUpdateTep::process() {
   // preserve old tep path if no new tep is supplied
   if (context_->tep_path.get().empty() &&
       context_->old_manifest_data.get()->tep_name) {
+    if (context_->manifest_data.get()->tep_name)
+      free(context_->manifest_data.get()->tep_name);
     context_->manifest_data.get()->tep_name =
         strdup(context_->old_manifest_data.get()->tep_name);
 
index 0bea3ac..0b6e9a9 100644 (file)
@@ -26,21 +26,31 @@ int PkgmgrAppInfoCallback(const pkgmgrinfo_appinfo_h handle,
     return PMINFO_R_ERROR;
 
   char* app_id = nullptr;
-  if (pkgmgrinfo_appinfo_get_appid(handle, &app_id))
+  if (pkgmgrinfo_appinfo_get_appid(handle, &app_id)) {
+    free(application);
     return PMINFO_R_ERROR;
+  }
 
   icon_x* icon = static_cast<icon_x*>(calloc(1, sizeof(icon_x)));
-  if (!icon)
+  if (!icon) {
+    free(application);
     return PMINFO_R_ERROR;
+  }
 
   char* icon_text = nullptr;
-  if (pkgmgrinfo_appinfo_get_icon(handle, &icon_text))
+  if (pkgmgrinfo_appinfo_get_icon(handle, &icon_text)) {
+    free(application);
+    free(icon);
     return PMINFO_R_ERROR;
+  }
 
   if (!mfx->root_path) {
     char *root_path = nullptr;
-    if (pkgmgrinfo_appinfo_get_root_path(handle, &root_path))
+    if (pkgmgrinfo_appinfo_get_root_path(handle, &root_path)) {
+      free(application);
+      free(icon);
       return PMINFO_R_ERROR;
+    }
     mfx->root_path = strdup(root_path);
   }
 
index 647666c..24befbb 100644 (file)
@@ -17,7 +17,7 @@
 template<typename Type>
 class Property {
  public:
-  Property() {}
+  Property() {} // NOLINT
   Property(const Type &val): value_(val) { } // NOLINT
   Property(Type &&val): value_(std::move(val)) { } // NOLINT
   const Type& get() const { return value_; }