Fix coverity issues. (#601) accepted/tizen/unified/20250304.125321 accepted/tizen/unified/x/20250304.152438
author조웅석/MDE Lab(SR)/삼성전자 <ws77.cho@samsung.com>
Tue, 4 Mar 2025 05:48:28 +0000 (14:48 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Tue, 4 Mar 2025 05:48:28 +0000 (14:48 +0900)
NativeLauncher/tool/ni_common.cc
NativeLauncher/util/path_manager.cc
NativeLauncher/util/utils.cc

index a404a9a7d30cc68c7fb95346d772ea0f36dca783..9bd09ad57dca4ba9229f9bb09b5f8aa65149eaad 100644 (file)
@@ -1341,7 +1341,7 @@ ni_error_e regeneratePkgNI(NIOption* opt, bool removeOnly)
        std::sort(pkgList.begin(), pkgList.end());
        pkgList.erase(unique(pkgList.begin(), pkgList.end()), pkgList.end());
 
-       for (auto pkg : pkgList) {
+       for (const auto pkg : pkgList) {
                if (isReadOnlyPkg(pkg) && opt->flags & NI_FLAGS_SKIP_RO_APP) {
                        continue;
                }
index 19dde34bb4e86ac1614bf751ebdc99955751b9b6..2527db6754ea4bf7d34fd557cc65214cbf60faf6 100644 (file)
@@ -177,7 +177,9 @@ void PathManager::setAppRootPath(const std::string& rootPath)
        // override root path for application launch mode (candidate / standalone mode)
        if (rootFD >= 0) {
                int tmpFD = open(appRootPath.c_str(), O_DIRECTORY);
-               dup3(tmpFD, rootFD, O_CLOEXEC);
+               if (dup3(tmpFD, rootFD, O_CLOEXEC) == -1) {
+                       _ERR("Failed to duplication app root path");
+               }
                if (tmpFD >= 0)
                        close(tmpFD);
        }
@@ -185,7 +187,9 @@ void PathManager::setAppRootPath(const std::string& rootPath)
        // override ni root path
        if (niRootFD >= 0) {
                int tmpFD = open(appNIRootPath.c_str(), O_DIRECTORY);
-               dup3(tmpFD, niRootFD, O_CLOEXEC);
+               if (dup3(tmpFD, niRootFD, O_CLOEXEC) == -1) {
+                       _ERR("Failed to duplication appni root path");
+               }
                if (tmpFD >= 0)
                        close(tmpFD);
        }
index 36ee7c9cb4c932ffded18f902c59bece1f224104..f165ea42d621223f97f2970206c3dc0acbfd8b1c 100644 (file)
@@ -762,9 +762,9 @@ std::string SHA256(const std::string& path)
        output = ss.str();
 
 cleanup1:
-       EVP_MD_CTX_free(mdctx);
-cleanup2:
        OPENSSL_free(digest);
+cleanup2:
+       EVP_MD_CTX_free(mdctx);
 cleanup3:
        free(buffer);
 cleanup4: