Fixed defects

List of Defects

Error: CPPCHECK_WARNING (CWE-664): [#def1]
dnf5-5.1.15-build/dnf5-5.1.15/dnf5-plugins/needs_restarting_plugin/needs_restarting.cpp:175: error[invalidContainerReference]: Reference to stack that may be invalid.
#  173|   
#  174|           libdnf5::rpm::PackageQuery query{installed};
#  175|->         query.filter_provides(current.get_requires());
#  176|   
#  177|           for (const auto & dependency : query) {

Error: CPPCHECK_WARNING: [#def2]
dnf5-5.1.15-build/dnf5-5.1.15/dnf5/main.cpp: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def3]
dnf5-5.1.15-build/dnf5-5.1.15/dnf5daemon-client/commands/repolist/repolist.cpp: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING (CWE-758): [#def4]
dnf5-5.1.15-build/dnf5-5.1.15/include/libdnf5-cli/output/transaction_table.hpp:47: error[missingReturn]: Found an exit path from function with non-void return type that has missing return statement
#   45|   
#   46|   static const char * action_color(libdnf5::transaction::TransactionItemAction action) {
#   47|->     switch (action) {
#   48|           case libdnf5::transaction::TransactionItemAction::INSTALL:
#   49|           case libdnf5::transaction::TransactionItemAction::UPGRADE:

Error: CPPCHECK_WARNING (CWE-562): [#def5]
dnf5-5.1.15-build/dnf5-5.1.15/libdnf5/conf/vars.cpp:307: error[invalidLifetime]: Using pointer to local variable 'empty' that is out of scope.
#  305|   
#  306|               // If there is no substitution to make, move past the variable expression and continue.
#  307|->             if (subst_str == nullptr) {
#  308|                   total_scanned += pos_after_variable_expression - pos;
#  309|                   pos = pos_after_variable_expression;

Error: CPPCHECK_WARNING: [#def6]
dnf5-5.1.15-build/dnf5-5.1.15/libdnf5/module/module_item.cpp: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING (CWE-562): [#def7]
dnf5-5.1.15-build/dnf5-5.1.15/libdnf5/repo/repo_sack.cpp:102: error[danglingLifetime]: Non-local variable 'cmdline_repo' will use pointer to local variable 'repo'.
#  100|           std::unique_ptr<Repo> repo(new Repo(base, CMDLINE_REPO_NAME, Repo::Type::COMMANDLINE));
#  101|           repo->get_config().get_build_cache_option().set(libdnf5::Option::Priority::RUNTIME, false);
#  102|->         cmdline_repo = repo.get();
#  103|           add_item(std::move(repo));
#  104|       }

Error: CPPCHECK_WARNING (CWE-562): [#def8]
dnf5-5.1.15-build/dnf5-5.1.15/libdnf5/repo/repo_sack.cpp:203: error[danglingLifetime]: Non-local variable 'system_repo' will use pointer to local variable 'repo'.
#  201|           // TODO(mblaha): re-enable caching once we can reliably detect whether system repo is up-to-date
#  202|           repo->get_config().get_build_cache_option().set(libdnf5::Option::Priority::RUNTIME, false);
#  203|->         system_repo = repo.get();
#  204|           add_item(std::move(repo));
#  205|       }

Scan Properties

analyzer-version-clang18.1.7
analyzer-version-cppcheck2.14.2
analyzer-version-gcc14.1.1
analyzer-version-gcc-analyzer14.1.1
analyzer-version-shellcheck0.10.0
diffbase-analyzer-version-clang18.1.7
diffbase-analyzer-version-cppcheck2.14.2
diffbase-analyzer-version-gcc14.1.1
diffbase-analyzer-version-gcc-analyzer14.1.1
diffbase-analyzer-version-shellcheck0.10.0
diffbase-enabled-pluginsclang, cppcheck, gcc, shellcheck
diffbase-exit-code0
diffbase-hostip-172-16-1-179.us-west-2.compute.internal
diffbase-mock-configfedora-41-x86_64
diffbase-project-namednf5-5.2.3.0-3.fc41
diffbase-store-results-to/tmp/tmpz6_sdbxt/dnf5-5.2.3.0-3.fc41.tar.xz
diffbase-time-created2024-07-03 12:41:06
diffbase-time-finished2024-07-03 12:58:49
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpz6_sdbxt/dnf5-5.2.3.0-3.fc41.tar.xz' '--gcc-analyze' '/tmp/tmpz6_sdbxt/dnf5-5.2.3.0-3.fc41.src.rpm'
diffbase-tool-versioncsmock-3.5.3-1.el9
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-179.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-namednf5-5.1.15-1.fc40
store-results-to/tmp/tmpug8n0x9m/dnf5-5.1.15-1.fc40.tar.xz
time-created2024-07-03 12:21:33
time-finished2024-07-03 12:40:52
titleFixed defects
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpug8n0x9m/dnf5-5.1.15-1.fc40.tar.xz' '--gcc-analyze' '/tmp/tmpug8n0x9m/dnf5-5.1.15-1.fc40.src.rpm'
tool-versioncsmock-3.5.3-1.el9