Fix static analysis issue 74/115074/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 08:00:13 +0000 (17:00 +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 e0fe86f7d23267f21435e77d312a88041b56e72a..64bc84511b39b1c42b70cc1b04e828e4c6ff57b5 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 0bea3ac3e66253272f5cc2c08f988df05c687cc7..0b6e9a9290fff96717cf8f89727b5a13179180ab 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 647666c9b91a3cb52e379b4f8ec8816f1f49114e..24befbba4645d115f0bf45d0f5ebb0e9a0af7a3f 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_; }