Fixed defects

List of Defects

Error: CLANG_WARNING: [#def1]
libvirt-10.1.0-build/libvirt-10.1.0/src/admin/libvirt-admin.c:40: included_from: Included from here.
libvirt-10.1.0-build/libvirt-10.1.0/src/admin/admin_remote.c:128: included_from: Included from here.
libvirt-10.1.0-build/libvirt-10.1.0/redhat-linux-build/src/admin/admin_client.h:95:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'tmp_results'
#   93|           for (i = 0; i < ret.servers.servers_len; i++)
#   94|               virObjectUnref(tmp_results[i]);
#   95|->         VIR_FREE(tmp_results);
#   96|       }
#   97|   

Error: CLANG_WARNING: [#def2]
libvirt-10.1.0-build/libvirt-10.1.0/src/admin/libvirt-admin.c:40: included_from: Included from here.
libvirt-10.1.0-build/libvirt-10.1.0/src/admin/admin_remote.c:128: included_from: Included from here.
libvirt-10.1.0-build/libvirt-10.1.0/redhat-linux-build/src/admin/admin_client.h:241:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'tmp_results'
#  239|           for (i = 0; i < ret.clients.clients_len; i++)
#  240|               virObjectUnref(tmp_results[i]);
#  241|->         VIR_FREE(tmp_results);
#  242|       }
#  243|   

Error: CLANG_WARNING: [#def3]
libvirt-10.1.0-build/libvirt-10.1.0/src/access/viraccessmanager.c:97:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'privateData'
#   95|   
#   96|       if (!(mgr = virObjectLockableNew(virAccessManagerClass))) {
#   97|->         VIR_FREE(privateData);
#   98|           return NULL;
#   99|       }

Error: CLANG_WARNING: [#def4]
libvirt-10.1.0-build/libvirt-10.1.0/src/conf/domain_event.c:2398:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'data'
# 2396|                                  _("failed to compile regex '%1$s': %2$s"),
# 2397|                                  event, err->message);
# 2398|->                 VIR_FREE(data);
# 2399|                   return -1;
# 2400|               }

Error: CLANG_WARNING: [#def5]
libvirt-10.1.0-build/libvirt-10.1.0/src/conf/virdomaincheckpointobjlist.c:67:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'checkpoints'
#   65|       checkpoints->base = virDomainMomentObjListNew();
#   66|       if (!checkpoints->base) {
#   67|->         VIR_FREE(checkpoints);
#   68|           return NULL;
#   69|       }

Error: CLANG_WARNING: [#def6]
libvirt-10.1.0-build/libvirt-10.1.0/src/conf/virdomaincheckpointobjlist.c:238:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'list'
#  236|           for (i = 0; i < count; i++)
#  237|               virObjectUnref(list[i]);
#  238|->         VIR_FREE(list);
#  239|       }
#  240|       return ret;

Error: CLANG_WARNING: [#def7]
libvirt-10.1.0-build/libvirt-10.1.0/src/conf/virdomainsnapshotobjlist.c:114:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'snapshots'
#  112|       snapshots->base = virDomainMomentObjListNew();
#  113|       if (!snapshots->base) {
#  114|->         VIR_FREE(snapshots);
#  115|           return NULL;
#  116|       }

Error: CLANG_WARNING: [#def8]
libvirt-10.1.0-build/libvirt-10.1.0/src/conf/virdomainsnapshotobjlist.c:312:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'list'
#  310|           for (i = 0; i < count; i++)
#  311|               virObjectUnref(list[i]);
#  312|->         VIR_FREE(list);
#  313|       }
#  314|       return ret;

Error: CLANG_WARNING: [#def9]
libvirt-10.1.0-build/libvirt-10.1.0/src/conf/virnwfilterobj.c:554:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'tmp_filters'
#  552|               virObjectUnref(tmp_filters[i]);
#  553|       }
#  554|->     VIR_FREE(tmp_filters);
#  555|       for (i = 0; i < nfilters; i++)
#  556|           virNWFilterObjUnlock(objs[i]);

Error: CLANG_WARNING: [#def10]
libvirt-10.1.0-build/libvirt-10.1.0/src/hypervisor/domain_interface.c:442:26: warning[core.NonNullParamChecker]: Null pointer passed to 2nd parameter expecting 'nonnull'
#  440|               ignore_value(virNetDevMidonetUnbindPort(vport));
#  441|           } else if (vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH) {
#  442|->             ignore_value(virNetDevOpenvswitchRemovePort(
#  443|                                   virDomainNetGetActualBridgeName(net),
#  444|                                   net->ifname));

Error: CLANG_WARNING: [#def11]
libvirt-10.1.0-build/libvirt-10.1.0/src/libxl/libxl_capabilities.c:306:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'cpus'
#  304|       }
#  305|   
#  306|->     VIR_FREE(cpus);
#  307|       VIR_FREE(nr_cpus_node);
#  308|       libxl_cputopology_list_free(cpu_topo, nr_cpus);

Error: CLANG_WARNING: [#def12]
libvirt-10.1.0-build/libvirt-10.1.0/src/libxl/libxl_capabilities.c:307:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'nr_cpus_node'
#  305|   
#  306|       VIR_FREE(cpus);
#  307|->     VIR_FREE(nr_cpus_node);
#  308|       libxl_cputopology_list_free(cpu_topo, nr_cpus);
#  309|       libxl_numainfo_list_free(numa_info, nr_nodes);

Error: CLANG_WARNING: [#def13]
libvirt-10.1.0-build/libvirt-10.1.0/src/libxl/libxl_conf.c:937:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'p'
#  935|               VIR_FREE(p->distances);
#  936|           }
#  937|->         VIR_FREE(vnuma_nodes);
#  938|       }
#  939|   

Error: CLANG_WARNING: [#def14]
libvirt-10.1.0-build/libvirt-10.1.0/src/libxl/libxl_conf.c:1593:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'x_vkbs'
# 1591|       }
# 1592|       VIR_FREE(x_vfbs);
# 1593|->     VIR_FREE(x_vkbs);
# 1594|       return -1;
# 1595|   }

Error: CLANG_WARNING: [#def15]
libvirt-10.1.0-build/libvirt-10.1.0/src/libxl/libxl_conf.c:2032:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'x_channels'
# 2030|       for (i = 0; i < nchannels; i++)
# 2031|           libxl_device_channel_dispose(&x_channels[i]);
# 2032|->     VIR_FREE(x_channels);
# 2033|       return -1;
# 2034|   }

Error: CLANG_WARNING: [#def16]
libvirt-10.1.0-build/libvirt-10.1.0/src/libxl/libxl_conf.c:2125:6: warning[unix.Malloc]: Potential leak of memory pointed to by 'x_controllers'
# 2123|        for (i = 0; i < ncontrollers; i++)
# 2124|            libxl_device_usbctrl_dispose(&x_controllers[i]);
# 2125|->      VIR_FREE(x_controllers);
# 2126|        return -1;
# 2127|   }

Error: CLANG_WARNING: [#def17]
libvirt-10.1.0-build/libvirt-10.1.0/src/libxl/libxl_conf.c:2170:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'x_usbctrls'
# 2168|           libxl_device_usbctrl_dispose(&x_usbctrls[i]);
# 2169|   
# 2170|->     VIR_FREE(x_usbctrls);
# 2171|       return -1;
# 2172|   }

Error: CLANG_WARNING: [#def18]
libvirt-10.1.0-build/libvirt-10.1.0/src/libxl/libxl_conf.c:2248:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'x_usbdevs'
# 2246|           libxl_device_usbdev_dispose(&x_usbdevs[i]);
# 2247|   
# 2248|->     VIR_FREE(x_usbdevs);
# 2249|       return -1;
# 2250|   }

Error: CLANG_WARNING: [#def19]
libvirt-10.1.0-build/libvirt-10.1.0/src/lxc/lxc_domain.c:374:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'data.st'
#  372|    cleanup:
#  373|       g_clear_pointer(&data.st, g_free);
#  374|->     g_clear_pointer(&data.st_valid, g_free);
#  375|       return ret;
#  376|   }

Error: CLANG_WARNING: [#def20]
libvirt-10.1.0-build/libvirt-10.1.0/src/lxc/lxc_domain.c:374:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'data.st_valid'
#  372|    cleanup:
#  373|       g_clear_pointer(&data.st, g_free);
#  374|->     g_clear_pointer(&data.st_valid, g_free);
#  375|       return ret;
#  376|   }

Error: CLANG_WARNING: [#def21]
libvirt-10.1.0-build/libvirt-10.1.0/src/lxc/lxc_native.c:747:13: warning[unix.Malloc]: Attempt to free released memory
#  745|           lxcNetworkParseData *data = networks.parseData[i];
#  746|           for (j = 0; j < data->nips; j++)
#  747|->             g_free(data->ips[j]);
#  748|           g_clear_pointer(&data->ips, g_free);
#  749|       }

Error: GCC_ANALYZER_WARNING (CWE-688): [#def22]
libvirt-10.1.0-build/libvirt-10.1.0/src/qemu/qemu_capabilities.c: scope_hint: In function ‘virQEMUCapsNewForBinaryInternal’
libvirt-10.1.0-build/libvirt-10.1.0/src/qemu/qemu_capabilities.c:5650:9: warning[-Wanalyzer-null-argument]: use of NULL ‘binary’ where non-null expected
/usr/include/glib-2.0/glib/gstring.h:37: included_from: Included from here.
/usr/include/glib-2.0/glib/giochannel.h:36: included_from: Included from here.
/usr/include/glib-2.0/glib.h:56: included_from: Included from here.
libvirt-10.1.0-build/libvirt-10.1.0/src/util/glibcompat.h:21: included_from: Included from here.
libvirt-10.1.0-build/libvirt-10.1.0/src/internal.h:30: included_from: Included from here.
libvirt-10.1.0-build/libvirt-10.1.0/src/util/virobject.h:24: included_from: Included from here.
libvirt-10.1.0-build/libvirt-10.1.0/src/qemu/qemu_capabilities.h:24: included_from: Included from here.
libvirt-10.1.0-build/libvirt-10.1.0/src/qemu/qemu_capabilities.c:24: included_from: Included from here.
libvirt-10.1.0-build/libvirt-10.1.0/src/qemu/qemu_capabilities.c:1825:24: note: in expansion of macro ‘g_strdup’
libvirt-10.1.0-build/libvirt-10.1.0/src/qemu/qemu_capabilities.c: scope_hint: In function ‘virQEMUCapsNewForBinaryInternal’
/usr/include/features.h:511: included_from: Included from here.
/usr/include/errno.h:25: included_from: Included from here.
libvirt-10.1.0-build/libvirt-10.1.0/src/internal.h:23: included_from: Included from here.
/usr/include/sys/stat.h:227:12: note: argument 1 of ‘stat’ must be non-null
# 5648|       /* We would also want to check faccessat if we cared about ACLs,
# 5649|        * but we don't.  */
# 5650|->     if (stat(binary, &sb) < 0) {
# 5651|           virReportSystemError(errno, _("Cannot check QEMU binary %1$s"),
# 5652|                                binary);

Error: CLANG_WARNING: [#def23]
libvirt-10.1.0-build/libvirt-10.1.0/src/remote/remote_daemon_dispatch.c:5895:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'files'
# 5893|       for (i = 0; i < nfiles; i++)
# 5894|           VIR_FORCE_CLOSE(files[i]);
# 5895|->     VIR_FREE(files);
# 5896|       if (rv < 0)
# 5897|           virNetMessageSaveError(rerr);

Error: CLANG_WARNING: [#def24]
libvirt-10.1.0-build/libvirt-10.1.0/src/remote/remote_daemon_dispatch.c:5942:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'files'
# 5940|       for (i = 0; i < nfiles; i++)
# 5941|           VIR_FORCE_CLOSE(files[i]);
# 5942|->     VIR_FREE(files);
# 5943|       if (rv < 0)
# 5944|           virNetMessageSaveError(rerr);

Error: CLANG_WARNING: [#def25]
libvirt-10.1.0-build/libvirt-10.1.0/src/remote/remote_daemon_stream.c:943:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'buffer'
#  941|       ret = 0;
#  942|    cleanup:
#  943|->     VIR_FREE(buffer);
#  944|       virNetMessageFree(msg);
#  945|       return ret;

Error: CLANG_WARNING: [#def26]
libvirt-10.1.0-build/libvirt-10.1.0/src/security/security_manager.c:105:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'privateData'
#  103|       return mgr;
#  104|    error:
#  105|->     VIR_FREE(privateData);
#  106|       virObjectUnref(mgr);
#  107|       return NULL;

Error: CLANG_WARNING: [#def27]
libvirt-10.1.0-build/libvirt-10.1.0/src/security/security_manager.c:674:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'sec_managers'
#  672|       if (generated)
#  673|           virSecurityLabelDefFree(seclabel);
#  674|->     VIR_FREE(sec_managers);
#  675|       return ret;
#  676|   }

Error: CLANG_WARNING: [#def28]
libvirt-10.1.0-build/libvirt-10.1.0/src/security/security_manager.c:734:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'sec_managers'
#  732|                      secmodel);
#  733|    cleanup:
#  734|->     VIR_FREE(sec_managers);
#  735|       return ret;
#  736|   }

Error: CLANG_WARNING: [#def29]
libvirt-10.1.0-build/libvirt-10.1.0/src/security/security_manager.c:1403:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'fds'
# 1401|       for (i = nfds; i > 0; i--)
# 1402|           VIR_FORCE_CLOSE(fds[i - 1]);
# 1403|->     VIR_FREE(fds);
# 1404|       VIR_FREE(locked_paths);
# 1405|       return ret;

Error: CLANG_WARNING: [#def30]
libvirt-10.1.0-build/libvirt-10.1.0/src/security/security_manager.c:1404:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'locked_paths'
# 1402|           VIR_FORCE_CLOSE(fds[i - 1]);
# 1403|       VIR_FREE(fds);
# 1404|->     VIR_FREE(locked_paths);
# 1405|       return ret;
# 1406|   }

Error: CLANG_WARNING: [#def31]
libvirt-10.1.0-build/libvirt-10.1.0/src/storage/storage_backend_gluster.c:140:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'ret'
#  138|    error:
#  139|       virStorageBackendGlusterClose(ret);
#  140|->     return NULL;
#  141|   }
#  142|   

Error: CLANG_WARNING: [#def32]
libvirt-10.1.0-build/libvirt-10.1.0/src/storage/storage_backend_gluster.c:375:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'state'
#  373|           glfs_closedir(dir);
#  374|       virStorageBackendGlusterClose(state);
#  375|->     return ret;
#  376|   }
#  377|   

Error: CLANG_WARNING: [#def33]
libvirt-10.1.0-build/libvirt-10.1.0/src/storage/storage_backend_gluster.c:435:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'state'
#  433|    cleanup:
#  434|       virStorageBackendGlusterClose(state);
#  435|->     return ret;
#  436|   }
#  437|   

Error: CLANG_WARNING: [#def34]
libvirt-10.1.0-build/libvirt-10.1.0/src/storage/storage_driver.c:2191:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'shadowvol'
# 2189|    cleanup:
# 2190|       virObjectUnref(newvol);
# 2191|->     VIR_FREE(shadowvol);
# 2192|       virStoragePoolObjEndAPI(&obj);
# 2193|       virStoragePoolObjEndAPI(&objsrc);

Error: CLANG_WARNING: [#def35]
libvirt-10.1.0-build/libvirt-10.1.0/src/test/test_driver.c:5336:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'ifaces_ret'
# 5334|       virDomainInterfaceFree(iface);
# 5335|   
# 5336|->     VIR_FREE(ifaces_ret);
# 5337|       return ret;
# 5338|   }

Error: CLANG_WARNING: [#def36]
libvirt-10.1.0-build/libvirt-10.1.0/src/util/vircommand.c:3288:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'reg'
# 3286|               for (j = 0; j < i; j++)
# 3287|                   g_regex_unref(reg[j]);
# 3288|->             VIR_FREE(reg);
# 3289|               return -1;
# 3290|           }

Error: CLANG_WARNING: [#def37]
libvirt-10.1.0-build/libvirt-10.1.0/src/util/vircommand.c:3345:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'groups'
# 3343|           for (j = 0; j < totgroups; j++)
# 3344|               VIR_FREE(groups[j]);
# 3345|->         VIR_FREE(groups);
# 3346|       }
# 3347|   

Error: CLANG_WARNING: [#def38]
libvirt-10.1.0-build/libvirt-10.1.0/src/util/virdevmapper.c:102:20: warning[unix.Malloc]: Potential leak of memory pointed to by '__p'
#  100|       *buf = g_new0(char, bufsize);
#  101|   
#  102|->     dm->version[0] = DM_VERSION_MAJOR;
#  103|       dm->version[1] = 0;
#  104|       dm->version[2] = 0;

Error: CLANG_WARNING: [#def39]
libvirt-10.1.0-build/libvirt-10.1.0/src/util/virhostcpu.c:451:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'cores_maps'
#  449|           for (i = 0; i < sock_max; i++)
#  450|               virBitmapFree(cores_maps[i]);
#  451|->     VIR_FREE(cores_maps);
#  452|   
#  453|       return ret;

Error: CLANG_WARNING: [#def40]
libvirt-10.1.0-build/libvirt-10.1.0/src/util/virtypedparam.c:465:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'filtered'
#  463|       }
#  464|   
#  465|->     VIR_FREE(filtered);
#  466|       return n;
#  467|   

Error: CLANG_WARNING: [#def41]
libvirt-10.1.0-build/libvirt-10.1.0/src/util/virutil.c:612:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'strbuf'
#  610|               VIR_FREE(*shell);
#  611|       }
#  612|->     VIR_FREE(strbuf);
#  613|       return ret;
#  614|   }

Error: CLANG_WARNING: [#def42]
libvirt-10.1.0-build/libvirt-10.1.0/src/util/virutil.c:653:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'strbuf'
#  651|           }
#  652|   
#  653|->         VIR_FREE(strbuf);
#  654|           return NULL;
#  655|       }

Error: CLANG_WARNING: [#def43]
libvirt-10.1.0-build/libvirt-10.1.0/src/util/virutil.c:736:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'strbuf'
#  734|   
#  735|    cleanup:
#  736|->     VIR_FREE(strbuf);
#  737|   
#  738|       return ret;

Error: CLANG_WARNING: [#def44]
libvirt-10.1.0-build/libvirt-10.1.0/src/util/virutil.c:816:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'strbuf'
#  814|   
#  815|    cleanup:
#  816|->     VIR_FREE(strbuf);
#  817|   
#  818|       return ret;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def45]
libvirt-10.1.0-build/libvirt-10.1.0/src/util/virutil.c: scope_hint: In function ‘virParseOwnershipIds’
libvirt-10.1.0-build/libvirt-10.1.0/src/util/virutil.c:1383:11: warning[-Wanalyzer-null-argument]: use of NULL ‘tmp_label’ where non-null expected
/usr/include/glib-2.0/glib/gstring.h:37: included_from: Included from here.
/usr/include/glib-2.0/glib/giochannel.h:36: included_from: Included from here.
/usr/include/glib-2.0/glib.h:56: included_from: Included from here.
libvirt-10.1.0-build/libvirt-10.1.0/src/util/glibcompat.h:21: included_from: Included from here.
libvirt-10.1.0-build/libvirt-10.1.0/src/internal.h:30: included_from: Included from here.
libvirt-10.1.0-build/libvirt-10.1.0/src/util/virerror.h:24: included_from: Included from here.
libvirt-10.1.0-build/libvirt-10.1.0/src/util/virutil.c:49: included_from: Included from here.
libvirt-10.1.0-build/libvirt-10.1.0/src/util/virutil.c:1380:17: note: in expansion of macro ‘g_strdup’
libvirt-10.1.0-build/libvirt-10.1.0/src/util/virutil.c: scope_hint: In function ‘virParseOwnershipIds’
<built-in>: note: argument 1 of ‘__builtin_strchr’ must be non-null
# 1381|   
# 1382|       /* Split label */
# 1383|->     sep = strchr(tmp_label, ':');
# 1384|       if (sep == NULL) {
# 1385|           virReportError(VIR_ERR_INVALID_ARG,

Error: CLANG_WARNING: [#def46]
libvirt-10.1.0-build/libvirt-10.1.0/src/vmx/vmx.c:1300:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'autodetectedModels'
# 1298|   
# 1299|    cleanup:
# 1300|->     VIR_FREE(autodetectedModels);
# 1301|   
# 1302|       return result;

Error: CLANG_WARNING: [#def47]
libvirt-10.1.0-build/libvirt-10.1.0/src/vmx/vmx.c:3660:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'preliminaryDisplayName'
# 3658|   
# 3659|    cleanup:
# 3660|->     VIR_FREE(preliminaryDisplayName);
# 3661|       VIR_FREE(displayName);
# 3662|       VIR_FREE(annotation);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def48]
libvirt-10.1.0-build/libvirt-10.1.0/tests/commandhelper.c:73:5: warning[-Wanalyzer-null-argument]: use of NULL ‘fopen("/builddir/build/BUILD/libvirt-10.1.0-build/libvirt-10.1.0/redhat-linux-build/tests/commandhelper.log", "w")’ where non-null expected
libvirt-10.1.0-build/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): [#def49]
libvirt-10.1.0-build/libvirt-10.1.0/tests/commandhelper.c: scope_hint: In function ‘main’
libvirt-10.1.0-build/libvirt-10.1.0/tests/commandhelper.c:350:17: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen("/builddir/build/BUILD/libvirt-10.1.0-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): [#def50]
libvirt-10.1.0-build/libvirt-10.1.0/tests/commandhelper.c:350:17: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen("/builddir/build/BUILD/libvirt-10.1.0-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): [#def51]
libvirt-10.1.0-build/libvirt-10.1.0/tests/securityselinuxlabeltest.c: scope_hint: In function ‘testSELinuxLoadFileList’
libvirt-10.1.0-build/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-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): [#def52]
libvirt-10.1.0-build/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-build/libvirt-10.1.0/tests", testname), "r")’
#  105|                              testname);
#  106|   
#  107|->     if (!(fp = fopen(path, "r")))
#  108|           return -1;
#  109|   

Error: CLANG_WARNING: [#def53]
libvirt-10.1.0-build/libvirt-10.1.0/tests/vircgrouptest.c:756:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'params'
#  754|   
#  755|    cleanup:
#  756|->     VIR_FREE(params);
#  757|       return ret;
#  758|   }

Error: GCC_ANALYZER_WARNING (CWE-775): [#def54]
libvirt-10.1.0-build/libvirt-10.1.0/tests/virhostcputest.c: scope_hint: In function ‘hostCPUSignature’
libvirt-10.1.0-build/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-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): [#def55]
libvirt-10.1.0-build/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-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: [#def56]
libvirt-10.1.0-build/libvirt-10.1.0/tests/virnetmessagetest.c:281:5: warning[unix.Malloc]: Potential leak of memory pointed to by '_pp.in'
#  279|       VIR_FREE(err.str1);
#  280|       VIR_FREE(err.str2);
#  281|->     VIR_FREE(err.str3);
#  282|       virNetMessageFree(msg);
#  283|       return ret;

Error: CLANG_WARNING: [#def57]
libvirt-10.1.0-build/libvirt-10.1.0/tests/virnetsockettest.c:285:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'lsock'
#  283|           virObjectUnref(lsock[i]);
#  284|       }
#  285|->     VIR_FREE(lsock);
#  286|       if (tmpdir)
#  287|           rmdir(tmpdir);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def58]
libvirt-10.1.0-build/libvirt-10.1.0/tools/virsh-domain.c: scope_hint: In function ‘cmdSchedInfoUpdate’
libvirt-10.1.0-build/libvirt-10.1.0/tools/virsh-domain.c:5182:25: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected
/usr/include/glib-2.0/glib/gstrfuncs.h:324:38: note: in definition of macro ‘g_strdup’
libvirt-10.1.0-build/libvirt-10.1.0/tools/virsh-domain.c:5180:38: note: in expansion of macro ‘g_strdup’
libvirt-10.1.0-build/libvirt-10.1.0/tools/virsh-domain.c: scope_hint: In function ‘cmdSchedInfoUpdate’
<built-in>: note: argument 1 of ‘__builtin_strchr’ must be non-null
# 5180|           g_autofree char *set_field = g_strdup(opt->data);
# 5181|   
# 5182|->         if (!(set_val = strchr(set_field, '='))) {
# 5183|               vshError(ctl, "%s", _("Invalid syntax for --set, expecting name=value"));
# 5184|               goto cleanup;

Error: CLANG_WARNING: [#def59]
libvirt-10.1.0-build/libvirt-10.1.0/tools/virsh-network.c:1001:5: warning[unix.Malloc]: Potential leak of memory pointed to by '_pp.in'
#  999|       for (i = 0; i < nAllNets; i++)
# 1000|           VIR_FREE(names[i]);
# 1001|->     VIR_FREE(names);
# 1002|   
# 1003|       if (!success) {

Error: CLANG_WARNING: [#def60]
libvirt-10.1.0-build/libvirt-10.1.0/tools/virsh-nodedev.c:563:9: warning[unix.Malloc]: Potential leak of memory pointed to by '_pp.in'
#  561|           for (i = 0; i < list->ndevices; i++)
#  562|               VIR_FREE(parents[i]);
#  563|->         VIR_FREE(parents);
#  564|           for (i = 0; i < list->ndevices; i++)
#  565|               VIR_FREE(names[i]);

Error: CLANG_WARNING: [#def61]
libvirt-10.1.0-build/libvirt-10.1.0/tools/virsh-nodedev.c:566:9: warning[unix.Malloc]: Potential leak of memory pointed to by '_pp.in'
#  564|           for (i = 0; i < list->ndevices; i++)
#  565|               VIR_FREE(names[i]);
#  566|->         VIR_FREE(names);
#  567|       } else {
#  568|           for (i = 0; i < list->ndevices; i++)

Error: CLANG_WARNING: [#def62]
libvirt-10.1.0-build/libvirt-10.1.0/tools/virsh-pool.c:1029:5: warning[unix.Malloc]: Potential leak of memory pointed to by '_pp.in'
# 1027|       }
# 1028|   
# 1029|->     VIR_FREE(names);
# 1030|       return list;
# 1031|   }

Error: CLANG_WARNING: [#def63]
libvirt-10.1.0-build/libvirt-10.1.0/tools/virsh-pool.c:1395:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'poolInfoTexts'
# 1393|           }
# 1394|       }
# 1395|->     VIR_FREE(poolInfoTexts);
# 1396|   
# 1397|       virshStoragePoolListFree(list);

Error: CLANG_WARNING: [#def64]
libvirt-10.1.0-build/libvirt-10.1.0/tools/virsh-volume.c:1478:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'volInfoTexts'
# 1476|   
# 1477|       /* Cleanup remaining memory */
# 1478|->     VIR_FREE(volInfoTexts);
# 1479|       virshStorageVolListFree(list);
# 1480|   

Error: CLANG_WARNING: [#def65]
libvirt-10.1.0-build/libvirt-10.1.0/tools/virt-login-shell-helper.c:409:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'seclabel'
#  407|       VIR_FREE(name);
#  408|       VIR_FREE(homedir);
#  409|->     VIR_FREE(seclabel);
#  410|       VIR_FREE(secmodel);
#  411|       VIR_FREE(groups);

Error: CLANG_WARNING: [#def66]
libvirt-10.1.0-build/libvirt-10.1.0/tools/vsh-table.c:393:5: warning[unix.Malloc]: Potential leak of memory pointed to by '_pp.in'
#  391|       for (i = 0; i < table->nrows; i++)
#  392|           VIR_FREE(widths[i]);
#  393|->     VIR_FREE(widths);
#  394|       return ret;
#  395|   }

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-245.us-west-2.compute.internal
diffbase-mock-configfedora-41-x86_64
diffbase-project-namelibvirt-10.4.0-2.fc41
diffbase-store-results-to/tmp/tmpebizceml/libvirt-10.4.0-2.fc41.tar.xz
diffbase-time-created2024-07-03 16:14:23
diffbase-time-finished2024-07-03 16:27:18
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpebizceml/libvirt-10.4.0-2.fc41.tar.xz' '--gcc-analyze' '/tmp/tmpebizceml/libvirt-10.4.0-2.fc41.src.rpm'
diffbase-tool-versioncsmock-3.5.3-1.el9
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-245.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-namelibvirt-10.1.0-1.fc40
store-results-to/tmp/tmpaqvo8iar/libvirt-10.1.0-1.fc40.tar.xz
time-created2024-07-03 16:00:40
time-finished2024-07-03 16:14:04
titleFixed defects
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpaqvo8iar/libvirt-10.1.0-1.fc40.tar.xz' '--gcc-analyze' '/tmp/tmpaqvo8iar/libvirt-10.1.0-1.fc40.src.rpm'
tool-versioncsmock-3.5.3-1.el9