Fixed defects

List of Defects

Error: GCC_ANALYZER_WARNING (CWE-688): [#def1]
libvirt-10.1.0/tests/commandhelper.c:73:5: warning[-Wanalyzer-null-argument]: use of NULL ‘fopen("/builddir/build/BUILD/libvirt-10.1.0/redhat-linux-build/tests/commandhelper.log", "w")’ where non-null expected
libvirt-10.1.0/tests/commandhelper.c: scope_hint: In function ‘main’
/usr/include/stdio.h: scope_hint: In function ‘main’
/usr/include/stdio.h:184:12: note: argument 1 of ‘fclose’ must be non-null
#   71|   {
#   72|       FILE *file = *ptr;
#   73|->     fclose(file);
#   74|   }
#   75|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def2]
libvirt-10.1.0/tests/commandhelper.c: scope_hint: In function ‘main’
libvirt-10.1.0/tests/commandhelper.c:350:17: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen("/builddir/build/BUILD/libvirt-10.1.0/redhat-linux-build/tests/commandhelper.log", "w")’
#  348|       cleanup(FILE *, cleanupFile) log = NULL;
#  349|   
#  350|->     if (!(log = fopen(abs_builddir "/commandhelper.log", "w")))
#  351|           return EXIT_FAILURE;
#  352|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def3]
libvirt-10.1.0/tests/commandhelper.c:350:17: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen("/builddir/build/BUILD/libvirt-10.1.0/redhat-linux-build/tests/commandhelper.log", "w")’
#  348|       cleanup(FILE *, cleanupFile) log = NULL;
#  349|   
#  350|->     if (!(log = fopen(abs_builddir "/commandhelper.log", "w")))
#  351|           return EXIT_FAILURE;
#  352|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def4]
libvirt-10.1.0/tests/securityselinuxlabeltest.c: scope_hint: In function ‘testSELinuxLoadFileList’
libvirt-10.1.0/tests/securityselinuxlabeltest.c:107:16: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(g_strdup_printf("%s/securityselinuxlabeldata/%s.txt", "/builddir/build/BUILD/libvirt-10.1.0/tests", testname), "r")’
#  105|                              testname);
#  106|   
#  107|->     if (!(fp = fopen(path, "r")))
#  108|           return -1;
#  109|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def5]
libvirt-10.1.0/tests/securityselinuxlabeltest.c:107:16: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(g_strdup_printf("%s/securityselinuxlabeldata/%s.txt", "/builddir/build/BUILD/libvirt-10.1.0/tests", testname), "r")’
#  105|                              testname);
#  106|   
#  107|->     if (!(fp = fopen(path, "r")))
#  108|           return -1;
#  109|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def6]
libvirt-10.1.0/tests/virhostcputest.c: scope_hint: In function ‘hostCPUSignature’
libvirt-10.1.0/tests/virhostcputest.c:193:15: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(g_strdup_printf("%s/virhostcpudata/linux-%s-%s.cpuinfo", "/builddir/build/BUILD/libvirt-10.1.0/tests", virArchToString(*(const struct linuxTestHostCPUData *)opaque.arch), *(const struct linuxTestHostCPUData *)opaque.testName), "r")’
#  191|                                  abs_srcdir, arch, data->testName);
#  192|   
#  193|->     if (!(f = fopen(cpuinfo, "r"))) {
#  194|           virReportSystemError(errno,
#  195|                                "Failed to open cpuinfo file '%s'", cpuinfo);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def7]
libvirt-10.1.0/tests/virhostcputest.c:193:15: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(g_strdup_printf("%s/virhostcpudata/linux-%s-%s.cpuinfo", "/builddir/build/BUILD/libvirt-10.1.0/tests", virArchToString(*(const struct linuxTestHostCPUData *)opaque.arch), *(const struct linuxTestHostCPUData *)opaque.testName), "r")’
#  191|                                  abs_srcdir, arch, data->testName);
#  192|   
#  193|->     if (!(f = fopen(cpuinfo, "r"))) {
#  194|           virReportSystemError(errno,
#  195|                                "Failed to open cpuinfo file '%s'", cpuinfo);

Error: CLANG_WARNING: [#def8]
libvirt-10.1.0/tools/vsh.c:661:25: warning[deadcode.DeadStores]: Value stored to 'fmt' during its initialization is never read
#  659|           const vshCmdOptDef *opt;
#  660|           for (opt = def->opts; opt->name; opt++) {
#  661|->             const char *fmt = "%s";
#  662|               switch (opt->type) {
#  663|               case VSH_OT_BOOL:

Scan Properties

analyzer-version-clang18.1.3
analyzer-version-cppcheck2.13.0
analyzer-version-gcc14.0.1
analyzer-version-gcc-analyzer14.0.1
analyzer-version-shellcheck0.10.0
diffbase-analyzer-version-clang18.1.3
diffbase-analyzer-version-cppcheck2.13.0
diffbase-analyzer-version-gcc14.0.1
diffbase-analyzer-version-gcc-analyzer14.0.1
diffbase-analyzer-version-shellcheck0.10.0
diffbase-enabled-pluginsclang, cppcheck, gcc, shellcheck
diffbase-exit-code0
diffbase-hostip-172-16-1-109.us-west-2.compute.internal
diffbase-mock-configfedora-41-x86_64
diffbase-project-namelibvirt-10.2.0-1.fc41
diffbase-store-results-to/tmp/tmppbfohbnw/libvirt-10.2.0-1.fc41.tar.xz
diffbase-time-created2024-04-25 17:50:06
diffbase-time-finished2024-04-25 18:09:09
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmppbfohbnw/libvirt-10.2.0-1.fc41.tar.xz' '--gcc-analyze' '/tmp/tmppbfohbnw/libvirt-10.2.0-1.fc41.src.rpm'
diffbase-tool-versioncsmock-3.5.3-1.el9
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-109.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-namelibvirt-10.1.0-1.fc41
store-results-to/tmp/tmpukxna8gl/libvirt-10.1.0-1.fc41.tar.xz
time-created2024-04-25 17:32:42
time-finished2024-04-25 17:49:36
titleFixed defects
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpukxna8gl/libvirt-10.1.0-1.fc41.tar.xz' '--gcc-analyze' '/tmp/tmpukxna8gl/libvirt-10.1.0-1.fc41.src.rpm'
tool-versioncsmock-3.5.3-1.el9