Fix static analysis issues 30/290830/2
authorSangyoon Jang <jeremy.jang@samsung.com>
Tue, 4 Apr 2023 04:52:12 +0000 (13:52 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Tue, 4 Apr 2023 04:55:45 +0000 (13:55 +0900)
Change-Id: Ia7ccc40f56b91a54dd93108b2c189ec7f0a0452a
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/common/step/configuration/step_parse_manifest.cc
src/common/step/filesystem/step_acquire_external_storage.h
src/common/step/filesystem/step_change_ownership_and_permission.h
src/common/step/filesystem/step_recover_files.cc
src/common/utils/property.h

index 906fda2..186b548 100644 (file)
@@ -754,6 +754,7 @@ bool StepParseManifest::FillWatchApplication(manifest_x* manifest) {
     if (!watch_application.app_info.setup_appid().empty())
       watch_app->setup_appid =
           strdup(watch_application.app_info.setup_appid().c_str());
+    manifest->application = g_list_append(manifest->application, watch_app);
 
     if (!FillLabel(watch_app, watch_application.label))
       return false;
@@ -768,7 +769,6 @@ bool StepParseManifest::FillWatchApplication(manifest_x* manifest) {
       return false;
     if (!FillResControl(watch_app, watch_application.res_controls))
       return false;
-    manifest->application = g_list_append(manifest->application, watch_app);
   }
   return true;
 }
index 58c3941..8220b93 100644 (file)
@@ -29,7 +29,7 @@ class StepAcquireExternalStorage : public Step {
   Status undo() override { return Status::OK; }
   Status precheck() override;
 
-  bool installed_;
+  bool installed_ = false;
 
   STEP_NAME(AcquireExternalStorage)
 };
index a7ee504..51df3c4 100644 (file)
@@ -31,7 +31,7 @@ class StepChangeOwnershipAndPermission : public Step {
   Status undo() override { return Status::OK; }
   Status precheck() override;
 
-  bool skip_symlink_;
+  bool skip_symlink_ = false;
 
   STEP_NAME(ChangeOwnershipAndPermission)
 };
index 6eb28cb..a4ef3e8 100644 (file)
@@ -102,7 +102,9 @@ Step::Status StepRecoverFiles::RecoveryMountUpdate() {
   bf::path backup_zip_location = GetBackupPathForZipFile(zip_location);
   if (bf::exists(backup_zip_location)) {
     Remove(zip_location);
-    MoveFile(backup_zip_location, zip_location);
+    if (!MoveFile(backup_zip_location, zip_location))
+      LOG(ERROR) << "Failed to move " << backup_zip_location << " to "
+          << zip_location;
   }
 
   // During mount update some files are still backed up separately from zip
@@ -164,4 +166,3 @@ bool StepRecoverFiles::ClearPath(const bf::path& path) {
 
 }  // namespace filesystem
 }  // namespace common_installer
-
index 24befbb..31e561d 100644 (file)
@@ -24,7 +24,7 @@ class Property {
   Type& get() { return value_; }
   void set(Type val) { value_ = std::move(val); }
  private:
-  Type value_;
+  Type value_{};
 };
 
 #endif  // COMMON_UTILS_PROPERTY_H_