Task #874 - libvirt-10.4.0-2.fc41/scan-results.err
back to task #874download
Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/examples/c/admin/logging.c:33:11: warning[deadcode.DeadStores]: Although the value stored to 'c' is used in the enclosing expression, the value is never actually read from 'c' # 31| const char *set_filters = NULL; # 32| # 33|-> ret = c = -1; # 34| opterr = 0; # 35| Error: CPPCHECK_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/examples/c/domain/domtop.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-479): libvirt-10.4.0-build/libvirt-10.4.0/examples/c/misc/event-test.c: scope_hint: In function ‘stop’ libvirt-10.4.0-build/libvirt-10.4.0/examples/c/misc/event-test.c:1119:5: warning[-Wanalyzer-unsafe-call-within-signal-handler]: call to ‘printf’ from within signal handler # 1117| stop(int sig) # 1118| { # 1119|-> printf("Exiting on signal %d\n", sig); # 1120| run = 0; # 1121| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:149:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 147| } # 148| # 149|-> if ((rv = virAccessManagerCheckDomain(mgr, conn->driver->name, domain, VIR_ACCESS_PERM_DOMAIN_GETATTR)) <= 0) { # 150| virObjectUnref(mgr); # 151| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:232:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 230| } # 231| # 232|-> if ((rv = virAccessManagerCheckDomain(mgr, conn->driver->name, domain, VIR_ACCESS_PERM_DOMAIN_GETATTR)) <= 0) { # 233| virObjectUnref(mgr); # 234| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:273:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 271| } # 272| # 273|-> if ((rv = virAccessManagerCheckDomain(mgr, conn->driver->name, domain, VIR_ACCESS_PERM_DOMAIN_GETATTR)) <= 0) { # 274| virObjectUnref(mgr); # 275| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:377:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 375| } # 376| # 377|-> if ((rv = virAccessManagerCheckDomain(mgr, conn->driver->name, domain, VIR_ACCESS_PERM_DOMAIN_READ)) <= 0) { # 378| virObjectUnref(mgr); # 379| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:649:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 647| } # 648| # 649|-> if ((rv = virAccessManagerCheckDomain(mgr, conn->driver->name, domain, VIR_ACCESS_PERM_DOMAIN_GETATTR)) <= 0) { # 650| virObjectUnref(mgr); # 651| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:690:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 688| } # 689| # 690|-> if ((rv = virAccessManagerCheckInterface(mgr, conn->driver->name, iface, VIR_ACCESS_PERM_INTERFACE_GETATTR)) <= 0) { # 691| virObjectUnref(mgr); # 692| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:731:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 729| } # 730| # 731|-> if ((rv = virAccessManagerCheckNetwork(mgr, conn->driver->name, network, VIR_ACCESS_PERM_NETWORK_GETATTR)) <= 0) { # 732| virObjectUnref(mgr); # 733| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:772:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 770| } # 771| # 772|-> if ((rv = virAccessManagerCheckNodeDevice(mgr, conn->driver->name, device, VIR_ACCESS_PERM_NODE_DEVICE_GETATTR)) <= 0) { # 773| virObjectUnref(mgr); # 774| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:813:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 811| } # 812| # 813|-> if ((rv = virAccessManagerCheckNWFilterBinding(mgr, conn->driver->name, binding, VIR_ACCESS_PERM_NWFILTER_BINDING_GETATTR)) <= 0) { # 814| virObjectUnref(mgr); # 815| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:854:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 852| } # 853| # 854|-> if ((rv = virAccessManagerCheckNWFilter(mgr, conn->driver->name, nwfilter, VIR_ACCESS_PERM_NWFILTER_GETATTR)) <= 0) { # 855| virObjectUnref(mgr); # 856| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:895:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 893| } # 894| # 895|-> if ((rv = virAccessManagerCheckSecret(mgr, conn->driver->name, secret, VIR_ACCESS_PERM_SECRET_GETATTR)) <= 0) { # 896| virObjectUnref(mgr); # 897| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:936:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 934| } # 935| # 936|-> if ((rv = virAccessManagerCheckStoragePool(mgr, conn->driver->name, pool, VIR_ACCESS_PERM_STORAGE_POOL_GETATTR)) <= 0) { # 937| virObjectUnref(mgr); # 938| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:977:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 975| } # 976| # 977|-> if ((rv = virAccessManagerCheckDomain(mgr, conn->driver->name, domain, VIR_ACCESS_PERM_DOMAIN_GETATTR)) <= 0) { # 978| virObjectUnref(mgr); # 979| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:1018:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 1016| } # 1017| # 1018|-> if ((rv = virAccessManagerCheckInterface(mgr, conn->driver->name, iface, VIR_ACCESS_PERM_INTERFACE_GETATTR)) <= 0) { # 1019| virObjectUnref(mgr); # 1020| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:1059:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 1057| } # 1058| # 1059|-> if ((rv = virAccessManagerCheckNetwork(mgr, conn->driver->name, network, VIR_ACCESS_PERM_NETWORK_GETATTR)) <= 0) { # 1060| virObjectUnref(mgr); # 1061| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:1100:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 1098| } # 1099| # 1100|-> if ((rv = virAccessManagerCheckStoragePool(mgr, conn->driver->name, pool, VIR_ACCESS_PERM_STORAGE_POOL_GETATTR)) <= 0) { # 1101| virObjectUnref(mgr); # 1102| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:1141:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 1139| } # 1140| # 1141|-> if ((rv = virAccessManagerCheckDomain(mgr, conn->driver->name, domain, VIR_ACCESS_PERM_DOMAIN_GETATTR)) <= 0) { # 1142| virObjectUnref(mgr); # 1143| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:1182:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 1180| } # 1181| # 1182|-> if ((rv = virAccessManagerCheckInterface(mgr, conn->driver->name, iface, VIR_ACCESS_PERM_INTERFACE_GETATTR)) <= 0) { # 1183| virObjectUnref(mgr); # 1184| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:1223:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 1221| } # 1222| # 1223|-> if ((rv = virAccessManagerCheckNetwork(mgr, conn->driver->name, network, VIR_ACCESS_PERM_NETWORK_GETATTR)) <= 0) { # 1224| virObjectUnref(mgr); # 1225| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:1264:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 1262| } # 1263| # 1264|-> if ((rv = virAccessManagerCheckNWFilter(mgr, conn->driver->name, nwfilter, VIR_ACCESS_PERM_NWFILTER_GETATTR)) <= 0) { # 1265| virObjectUnref(mgr); # 1266| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:1305:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 1303| } # 1304| # 1305|-> if ((rv = virAccessManagerCheckSecret(mgr, conn->driver->name, secret, VIR_ACCESS_PERM_SECRET_GETATTR)) <= 0) { # 1306| virObjectUnref(mgr); # 1307| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:1346:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 1344| } # 1345| # 1346|-> if ((rv = virAccessManagerCheckStoragePool(mgr, conn->driver->name, pool, VIR_ACCESS_PERM_STORAGE_POOL_GETATTR)) <= 0) { # 1347| virObjectUnref(mgr); # 1348| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:1408:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 1406| } # 1407| # 1408|-> if ((rv = virAccessManagerCheckNetwork(mgr, conn->driver->name, network, VIR_ACCESS_PERM_NETWORK_GETATTR)) <= 0) { # 1409| virObjectUnref(mgr); # 1410| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:1470:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 1468| } # 1469| # 1470|-> if ((rv = virAccessManagerCheckNodeDevice(mgr, conn->driver->name, device, VIR_ACCESS_PERM_NODE_DEVICE_GETATTR)) <= 0) { # 1471| virObjectUnref(mgr); # 1472| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:1511:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 1509| } # 1510| # 1511|-> if ((rv = virAccessManagerCheckDomain(mgr, conn->driver->name, domain, VIR_ACCESS_PERM_DOMAIN_GETATTR)) <= 0) { # 1512| virObjectUnref(mgr); # 1513| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:1552:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 1550| } # 1551| # 1552|-> if ((rv = virAccessManagerCheckInterface(mgr, conn->driver->name, iface, VIR_ACCESS_PERM_INTERFACE_GETATTR)) <= 0) { # 1553| virObjectUnref(mgr); # 1554| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:1593:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 1591| } # 1592| # 1593|-> if ((rv = virAccessManagerCheckNetwork(mgr, conn->driver->name, network, VIR_ACCESS_PERM_NETWORK_GETATTR)) <= 0) { # 1594| virObjectUnref(mgr); # 1595| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:1634:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 1632| } # 1633| # 1634|-> if ((rv = virAccessManagerCheckStoragePool(mgr, conn->driver->name, pool, VIR_ACCESS_PERM_STORAGE_POOL_GETATTR)) <= 0) { # 1635| virObjectUnref(mgr); # 1636| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:1675:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 1673| } # 1674| # 1675|-> if ((rv = virAccessManagerCheckDomain(mgr, conn->driver->name, domain, VIR_ACCESS_PERM_DOMAIN_GETATTR)) <= 0) { # 1676| virObjectUnref(mgr); # 1677| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:1716:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 1714| } # 1715| # 1716|-> if ((rv = virAccessManagerCheckInterface(mgr, conn->driver->name, iface, VIR_ACCESS_PERM_INTERFACE_GETATTR)) <= 0) { # 1717| virObjectUnref(mgr); # 1718| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:1757:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 1755| } # 1756| # 1757|-> if ((rv = virAccessManagerCheckNetwork(mgr, conn->driver->name, network, VIR_ACCESS_PERM_NETWORK_GETATTR)) <= 0) { # 1758| virObjectUnref(mgr); # 1759| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:1798:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 1796| } # 1797| # 1798|-> if ((rv = virAccessManagerCheckNWFilter(mgr, conn->driver->name, nwfilter, VIR_ACCESS_PERM_NWFILTER_GETATTR)) <= 0) { # 1799| virObjectUnref(mgr); # 1800| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:1839:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 1837| } # 1838| # 1839|-> if ((rv = virAccessManagerCheckSecret(mgr, conn->driver->name, secret, VIR_ACCESS_PERM_SECRET_GETATTR)) <= 0) { # 1840| virObjectUnref(mgr); # 1841| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:1880:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 1878| } # 1879| # 1880|-> if ((rv = virAccessManagerCheckStoragePool(mgr, conn->driver->name, pool, VIR_ACCESS_PERM_STORAGE_POOL_GETATTR)) <= 0) { # 1881| virObjectUnref(mgr); # 1882| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:1984:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 1982| } # 1983| # 1984|-> if ((rv = virAccessManagerCheckSecret(mgr, conn->driver->name, secret, VIR_ACCESS_PERM_SECRET_GETATTR)) <= 0) { # 1985| virObjectUnref(mgr); # 1986| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:2067:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 2065| } # 2066| # 2067|-> if ((rv = virAccessManagerCheckStoragePool(mgr, conn->driver->name, pool, VIR_ACCESS_PERM_STORAGE_POOL_GETATTR)) <= 0) { # 2068| virObjectUnref(mgr); # 2069| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:7454:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 7452| } # 7453| # 7454|-> if ((rv = virAccessManagerCheckNetworkPort(mgr, conn->driver->name, net, port, VIR_ACCESS_PERM_NETWORK_PORT_GETATTR)) <= 0) { # 7455| virObjectUnref(mgr); # 7456| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:8460:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 8458| } # 8459| # 8460|-> if ((rv = virAccessManagerCheckNodeDevice(mgr, conn->driver->name, device, VIR_ACCESS_PERM_NODE_DEVICE_GETATTR)) <= 0) { # 8461| virObjectUnref(mgr); # 8462| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:8501:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 8499| } # 8500| # 8501|-> if ((rv = virAccessManagerCheckNodeDevice(mgr, conn->driver->name, device, VIR_ACCESS_PERM_NODE_DEVICE_GETATTR)) <= 0) { # 8502| virObjectUnref(mgr); # 8503| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:9207:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 9205| } # 9206| # 9207|-> if ((rv = virAccessManagerCheckStorageVol(mgr, conn->driver->name, pool, vol, VIR_ACCESS_PERM_STORAGE_VOL_GETATTR)) <= 0) { # 9208| virObjectUnref(mgr); # 9209| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:9248:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 9246| } # 9247| # 9248|-> if ((rv = virAccessManagerCheckStorageVol(mgr, conn->driver->name, pool, vol, VIR_ACCESS_PERM_STORAGE_VOL_GETATTR)) <= 0) { # 9249| virObjectUnref(mgr); # 9250| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheck.c:9373:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 9371| } # 9372| # 9373|-> if ((rv = virAccessManagerCheckStorageVol(mgr, conn->driver->name, pool, vol, VIR_ACCESS_PERM_STORAGE_VOL_GETATTR)) <= 0) { # 9374| virObjectUnref(mgr); # 9375| virResetLastError(); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/access/viraccessapicheckqemu.c:72:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 70| } # 71| # 72|-> if ((rv = virAccessManagerCheckDomain(mgr, conn->driver->name, domain, VIR_ACCESS_PERM_DOMAIN_GETATTR)) <= 0) { # 73| virObjectUnref(mgr); # 74| virResetLastError(); Error: CPPCHECK_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/scripts/rpcgen/tests/test_demo.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/backup_conf.c:212:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'def' # 210| if ((mode = virXMLPropString(ctxt->node, "mode"))) { # 211| if ((def->type = virDomainBackupTypeFromString(mode)) <= 0) { # 212|-> virReportError(VIR_ERR_CONFIG_UNSUPPORTED, # 213| _("unknown backup mode '%1$s'"), mode); # 214| return NULL; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/capabilities.c:783:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'capsdata' # 781| reportError); # 782| # 783|-> return capsdata != NULL; # 784| } # 785| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/capabilities.c:1518:5: warning[deadcode.DeadStores]: Value stored to 'tmp_size' is never read # 1516| *ndistancesRet = tmp_size; # 1517| *distancesRet = g_steal_pointer(&tmp); # 1518|-> tmp_size = 0; # 1519| # 1520| return 0; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/capabilities.c:1842:13: warning[deadcode.DeadStores]: Although the value stored to 'direrr' is used in the enclosing expression, the value is never actually read from 'direrr' # 1840| return -1; # 1841| # 1842|-> while ((direrr = virDirRead(dir, &entry, path)) > 0) { # 1843| const char *dname = STRSKIP(entry->d_name, "node"); # 1844| unsigned int initNode; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/capabilities.c:1906:20: warning[deadcode.DeadStores]: Although the value stored to 'direrr' is used in the enclosing expression, the value is never actually read from 'direrr' # 1904| return -1; # 1905| # 1906|-> while (dir && (direrr = virDirRead(dir, &entry, path)) > 0) { # 1907| const char *dname = STRSKIP(entry->d_name, "node"); # 1908| unsigned int node; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/capabilities.c:2129:38: warning[core.NullDereference]: Array access (via field 'banks') results in a null pointer dereference # 2127| # 2128| for (i = 0; i < caps->host.cache.nbanks; i++) { # 2129|-> virCapsHostCacheBank *bank = caps->host.cache.banks[i]; # 2130| node = g_new0(virCapsHostMemBWNode, 1); # 2131| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/cpu_conf.c:297:11: warning[deadcode.DeadStores]: Although the value stored to 'doc' is used in the enclosing expression, the value is never actually read from 'doc' # 295| } # 296| # 297|-> if (!(doc = virXMLParseStringCtxt(xml, _("(CPU_definition)"), &ctxt))) # 298| return -1; # 299| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/cpu_conf.c:397:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'def' # 395| if (virXPathBoolean("boolean(./arch)", ctxt)) { # 396| if (virXPathBoolean("boolean(./@match)", ctxt)) { # 397|-> virReportError(VIR_ERR_XML_ERROR, "%s", # 398| _("'arch' element cannot be used inside 'cpu' element with 'match' attribute'")); # 399| return -1; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/cpu_conf.c:1239:15: warning[deadcode.DeadStores]: Although the value stored to 'doc' is used in the enclosing expression, the value is never actually read from 'doc' # 1237| g_autoptr(xmlXPathContext) ctxt = NULL; # 1238| # 1239|-> if (!(doc = virXMLParseStringCtxt(xmlCPUs[i], _("(CPU_definition)"), &ctxt))) # 1240| goto error; # 1241| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/domain_nwfilter.c:62:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'ret' # 60| if (net->filterparams && # 61| virNWFilterHashTablePutAll(net->filterparams, ret->filterparams) < 0) # 62|-> return NULL; # 63| # 64| return g_steal_pointer(&ret); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/interface_conf.c:359:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'proto' # 357| # 358| if (!(proto->family = virXMLPropString(protoNodes[pp], "family"))) { # 359|-> virReportError(VIR_ERR_XML_ERROR, # 360| "%s", _("protocol misses the family attribute")); # 361| return -1; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/interface_conf.c:588:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'def' # 586| || (parentIfType == VIR_INTERFACE_TYPE_VLAN)) # 587| { # 588|-> virReportError(VIR_ERR_XML_ERROR, # 589| _("interface has unsupported type '%1$s'"), # 590| virInterfaceTypeToString(type)); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/interface_conf.c:596:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'def' # 594| # 595| if (!(def->name = virXMLPropString(ctxt->node, "name"))) { # 596|-> virReportError(VIR_ERR_XML_ERROR, "%s", _("interface has no name")); # 597| return NULL; # 598| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/interface_conf.c:679:11: warning[deadcode.DeadStores]: Although the value stored to 'xml' is used in the enclosing expression, the value is never actually read from 'xml' # 677| bool validate = flags & VIR_INTERFACE_DEFINE_VALIDATE; # 678| # 679|-> if (!(xml = virXMLParse(NULL, xmlStr, _("(interface_definition)"), # 680| "interface", &ctxt, "interface.rng", validate))) # 681| return NULL; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/netdev_bandwidth_conf.c:103:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'def' # 101| # 102| if ((rc = virXMLPropUInt(node, "classID", 10, VIR_XML_PROP_NONE, &class_id_value)) < 0) # 103|-> return -1; # 104| # 105| if (rc == 1) { Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/netdev_vport_profile_conf.c:52:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'virtPort' # 50| if ((virtPort->virtPortType == VIR_NETDEV_VPORT_PROFILE_NONE) && # 51| (flags & VIR_VPORT_XML_REQUIRE_TYPE)) { # 52|-> virReportError(VIR_ERR_XML_ERROR, "%s", # 53| _("missing required virtualport type")); # 54| return NULL; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/network_conf.c:665:25: warning[unix.Malloc]: Potential leak of memory pointed to by 'hostnames' # 663| for (i = 0; i < hostnameNodes->len; i++) { # 664| if (!(hostnames[i] = virXMLNodeContentString(g_ptr_array_index(hostnameNodes, i)))) # 665|-> return -1; # 666| # 667| if (*hostnames[i] == '\0') { Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/network_conf.c:1395:21: warning[core.NonNullParamChecker]: Null pointer passed to 2nd parameter expecting 'nonnull' # 1393| * present. If they don't match, it's an error. # 1394| */ # 1395|-> if (STRNEQ(forwardDevi, def->ifs[0].device.dev)) { # 1396| virReportError(VIR_ERR_XML_ERROR, # 1397| _("<forward dev='%1$s'> must match first <interface dev='%2$s'/> in network %3$s"), Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/network_conf.c:1524:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'def' # 1522| def->name = virXPathString("string(./name[1])", ctxt); # 1523| if (!def->name) { # 1524|-> virReportError(VIR_ERR_NO_NAME, NULL); # 1525| return NULL; # 1526| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/network_conf.c:3394:11: warning[deadcode.DeadStores]: Although the value stored to 'doc' is used in the enclosing expression, the value is never actually read from 'doc' # 3392| g_autoptr(xmlXPathContext) ctxt = NULL; # 3393| # 3394|-> if (!(doc = virXMLParseStringCtxt(xml, _("network_update_xml"), &ctxt))) # 3395| return -1; # 3396| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/networkcommon_conf.c:56:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'def' # 54| # 55| if (!address) { # 56|-> virReportError(VIR_ERR_XML_ERROR, # 57| _("%1$s: Missing required address attribute in route definition"), # 58| errorDetail); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/node_device_conf.c:1076:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'newres' # 1074| # 1075| if (!(newres->name = virXPathString("string(./name)", ctxt))) { # 1076|-> virReportError(VIR_ERR_XML_ERROR, "%s", # 1077| _("Could not read a device name from the <name> element")); # 1078| return -1; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/node_device_conf.c:2368:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'def' # 2366| # 2367| if (!def->name) { # 2368|-> virReportError(VIR_ERR_NO_NAME, NULL); # 2369| return NULL; # 2370| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/node_device_conf.c:2465:11: warning[deadcode.DeadStores]: Although the value stored to 'xml' is used in the enclosing expression, the value is never actually read from 'xml' # 2463| g_autoptr(virNodeDeviceDef) def = NULL; # 2464| # 2465|-> if (!(xml = virXMLParse(filename, str, _("(node_device_definition)"), # 2466| "device", &ctxt, "nodedev.rng", validate))) # 2467| return NULL; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/nwfilter_conf.c:2037:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'ret' # 2035| # 2036| if (!(ret->filterref = virXMLPropStringRequired(cur, "filter"))) # 2037|-> return NULL; # 2038| # 2039| if (!(ret->params = virNWFilterParseParamAttributes(cur))) Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/nwfilter_conf.c:2526:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'ret' # 2524| ret->name = virXPathString("string(./@name)", ctxt); # 2525| if (!ret->name) { # 2526|-> virReportError(VIR_ERR_INTERNAL_ERROR, # 2527| "%s", _("filter has no name")); # 2528| return NULL; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/nwfilter_conf.c:2627:11: warning[deadcode.DeadStores]: Although the value stored to 'xml' is used in the enclosing expression, the value is never actually read from 'xml' # 2625| bool validate = flags & VIR_NWFILTER_DEFINE_VALIDATE; # 2626| # 2627|-> if (!(xml = virXMLParse(filename, xmlStr, _("(nwfilter_definition)"), # 2628| "filter", &ctxt, "nwfilter.rng", validate))) # 2629| return NULL; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/secret_conf.c:186:11: warning[deadcode.DeadStores]: Although the value stored to 'xml' is used in the enclosing expression, the value is never actually read from 'xml' # 184| bool validate = flags & VIR_SECRET_DEFINE_VALIDATE; # 185| # 186|-> if (!(xml = virXMLParse(filename, xmlStr, _("(definition_of_secret)"), # 187| "secret", &ctxt, "secret.rng", validate))) # 188| return NULL; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/snapshot_conf.c:276:14: warning[deadcode.DeadStores]: Although the value stored to 'domtype' is used in the enclosing expression, the value is never actually read from 'domtype' # 274| * clients will have to decide between best effort # 275| * initialization or outright failure. */ # 276|-> if ((domtype = virXPathString("string(./domain/@type)", ctxt))) { # 277| VIR_XPATH_NODE_AUTORESTORE(ctxt) # 278| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/storage_conf.c:665:11: warning[deadcode.DeadStores]: Although the value stored to 'doc' is used in the enclosing expression, the value is never actually read from 'doc' # 663| g_autoptr(virStoragePoolSource) def = NULL; # 664| # 665|-> if (!(doc = virXMLParse(NULL, srcSpec, _("(storage_source_specification)"), # 666| "source", &xpath_ctxt, NULL, false))) # 667| return NULL; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/storage_conf.c:833:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'def' # 831| if (virXMLPropEnum(ctxt->node, "type", virStoragePoolTypeFromString, # 832| VIR_XML_PROP_REQUIRED, &type) < 0) # 833|-> return NULL; # 834| # 835| def->type = type; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/storage_conf.c:978:11: warning[deadcode.DeadStores]: Although the value stored to 'xml' is used in the enclosing expression, the value is never actually read from 'xml' # 976| # 977| # 978|-> if (!(xml = virXMLParse(filename, xmlStr, _("(storage_pool_definition)"), # 979| "pool", &ctxt, "storagepool.rng", validate))) # 980| return NULL; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/storage_conf.c:1260:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'def' # 1258| def->name = virXPathString("string(./name)", ctxt); # 1259| if (def->name == NULL) { # 1260|-> virReportError(VIR_ERR_XML_ERROR, "%s", # 1261| _("missing volume name element")); # 1262| return NULL; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/storage_conf.c:1408:11: warning[deadcode.DeadStores]: Although the value stored to 'xml' is used in the enclosing expression, the value is never actually read from 'xml' # 1406| bool validate = flags & VIR_VOL_XML_PARSE_VALIDATE; # 1407| # 1408|-> if (!(xml = virXMLParse(filename, xmlStr, _("(storage_volume_definition)"), # 1409| "volume", &ctxt, "storagevol.rng", validate))) # 1410| return NULL; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/storage_source_conf.c:250:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'authdef' # 248| # 249| if (!(authdef->username = virXPathString("string(./@username)", ctxt))) { # 250|-> virReportError(VIR_ERR_XML_ERROR, "%s", # 251| _("missing username for auth")); # 252| return NULL; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/storage_source_conf.c:618:30: warning[core.NullDereference]: Access to field 'name' results in a dereference of a null pointer # 616| # 617| for (i = 0; i < from->ncookies; i++) { # 618|-> to->cookies[i]->name = g_strdup(from->cookies[i]->name); # 619| to->cookies[i]->value = g_strdup(from->cookies[i]->value); # 620| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virdomainmomentobjlist.c:380:13: warning[core.NullDereference]: Dereference of null pointer (loaded from variable '_pp') # 378| if (data.error) { # 379| for (i = 0; i < data.count; i++) # 380|-> VIR_FREE(names[i]); # 381| return -1; # 382| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virinterfaceobj.c:327:17: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'ifaces') # 325| /* trim the array to the final size */ # 326| VIR_REALLOC_N(data.ifaces, data.nifaces + 1); # 327|-> *ifaces = g_steal_pointer(&data.ifaces); # 328| } # 329| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virnetworkobj.c:1239:15: warning[deadcode.DeadStores]: Although the value stored to 'checkdef' is used in the enclosing expression, the value is never actually read from 'checkdef' # 1237| * add anything illegal to the def # 1238| */ # 1239|-> if (!(checkdef = virNetworkDefCopy(livedef, xmlopt, 0))) # 1240| return -1; # 1241| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virnetworkobj.c:1256:15: warning[deadcode.DeadStores]: Although the value stored to 'checkdef' is used in the enclosing expression, the value is never actually read from 'checkdef' # 1254| return -1; # 1255| } # 1256|-> if (!(checkdef = virNetworkDefCopy(configdef, # 1257| xmlopt, # 1258| VIR_NETWORK_XML_INACTIVE))) { Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virnetworkobj.c:1387:15: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'nets') # 1385| /* trim the array to the final size */ # 1386| VIR_REALLOC_N(data.nets, data.nnets + 1); # 1387|-> *nets = g_steal_pointer(&data.nets); # 1388| } # 1389| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virnetworkobj.c:1685:13: warning[deadcode.DeadStores]: Although the value stored to 'rc' is used in the enclosing expression, the value is never actually read from 'rc' # 1683| return rc; # 1684| # 1685|-> while ((rc = virDirRead(dh, &de, dir)) > 0) { # 1686| char *file = NULL; # 1687| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virnetworkobj.c:1771:16: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'ports') # 1769| /* trim the array to the final size */ # 1770| VIR_REALLOC_N(data.ports, data.nports + 1); # 1771|-> *ports = g_steal_pointer(&data.ports); # 1772| } # 1773| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virnetworkobj.c:1834:13: warning[deadcode.DeadStores]: Although the value stored to 'rc' is used in the enclosing expression, the value is never actually read from 'rc' # 1832| return rc; # 1833| # 1834|-> while ((rc = virDirRead(dh, &de, dir)) > 0) { # 1835| g_autofree char *file = NULL; # 1836| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virnetworkportdef.c:100:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'def' # 98| uuid = virXPathString("string(./uuid)", ctxt); # 99| if (!uuid) { # 100|-> virReportError(VIR_ERR_INTERNAL_ERROR, # 101| "%s", _("network port has no uuid")); # 102| return NULL; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virnetworkportdef.c:263:11: warning[deadcode.DeadStores]: Although the value stored to 'xml' is used in the enclosing expression, the value is never actually read from 'xml' # 261| bool validate = flags & VIR_NETWORK_PORT_CREATE_VALIDATE; # 262| # 263|-> if (!(xml = virXMLParse(filename, xmlStr, _("(networkport_definition)"), # 264| "networkport", &ctxt, "networkport.rng", validate))) # 265| return NULL; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virnodedeviceobj.c:997:18: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'devices') # 995| if (data.devices) { # 996| VIR_REALLOC_N(data.devices, data.ndevices + 1); # 997|-> *devices = data.devices; # 998| } # 999| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virnwfilterbindingdef.c:68:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'ret' # 66| # 67| if (virNWFilterHashTablePutAll(src->filterparams, ret->filterparams) < 0) # 68|-> return NULL; # 69| # 70| return g_steal_pointer(&ret); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virnwfilterbindingdef.c:166:11: warning[deadcode.DeadStores]: Although the value stored to 'xml' is used in the enclosing expression, the value is never actually read from 'xml' # 164| bool validate = flags & VIR_NWFILTER_BINDING_CREATE_VALIDATE; # 165| # 166|-> if (!(xml = virXMLParse(filename, xmlStr, _("(nwfilterbinding_definition)"), # 167| "filterbinding", &ctxt, "nwfilterbinding.rng", validate))) # 168| return NULL; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virnwfilterbindingobj.c:205:11: warning[deadcode.DeadStores]: Although the value stored to 'xml' is used in the enclosing expression, the value is never actually read from 'xml' # 203| xmlNodePtr node; # 204| # 205|-> if (!(xml = virXMLParse(filename, NULL, _("(nwfilterbinding_status)"), # 206| "filterbindingstatus", &ctxt, NULL, false))) # 207| return NULL; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virsavecookie.c:67:11: warning[deadcode.DeadStores]: Although the value stored to 'doc' is used in the enclosing expression, the value is never actually read from 'doc' # 65| return 0; # 66| # 67|-> if (!(doc = virXMLParse(NULL, xml, _("(save cookie)"), "cookie", &ctxt, NULL, false))) # 68| return -1; # 69| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virsecretobj.c:600:18: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'secrets') # 598| /* trim the array to the final size */ # 599| VIR_REALLOC_N(data.secrets, data.nsecrets + 1); # 600|-> *secrets = data.secrets; # 601| } # 602| Error: GCC_ANALYZER_WARNING (CWE-465): libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virstorageobj.c: scope_hint: In function ‘virStoragePoolObjSourceMatchTypeDEVICE’ libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virstorageobj.c:1358:12: warning[-Wanalyzer-deref-before-check]: check of ‘obj’ for NULL after already dereferencing it # 1356| return NULL; # 1357| # 1358|-> if ((matchobj = virStoragePoolSourceFindDuplicateDevices(obj, def))) { # 1359| if (!virStoragePoolSourceISCSIMatch(matchobj, def)) # 1360| return NULL; Error: GCC_ANALYZER_WARNING (CWE-465): libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virstorageobj.c: scope_hint: In function ‘virStoragePoolObjSourceFindDuplicateCb’ libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virstorageobj.c:1397:47: warning[-Wanalyzer-deref-before-check]: check of ‘payload’ for NULL after already dereferencing it libvirt-10.4.0-build/libvirt-10.4.0/src/datatypes.h:24: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virstorageobj.c:23: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:79:29: note: in definition of macro ‘STREQ’ # 1395| case VIR_STORAGE_POOL_GLUSTER: # 1396| case VIR_STORAGE_POOL_NETFS: # 1397|-> if (data->def->type == obj->def->type && # 1398| virStoragePoolObjSourceMatchTypeDIR(obj, data->def)) # 1399| return 1; Error: GCC_ANALYZER_WARNING (CWE-465): libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virstorageobj.c:1403:47: warning[-Wanalyzer-deref-before-check]: check of ‘payload’ for NULL after already dereferencing it libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:79:29: note: in definition of macro ‘STREQ’ libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:79:32: note: in definition of macro ‘STREQ’ # 1401| # 1402| case VIR_STORAGE_POOL_SCSI: # 1403|-> if (data->def->type == obj->def->type && # 1404| virStoragePoolObjSourceMatchTypeISCSI(obj, data->def)) # 1405| return 1; Error: GCC_ANALYZER_WARNING (CWE-465): libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virstorageobj.c:1417:55: warning[-Wanalyzer-deref-before-check]: check of ‘payload’ for NULL after already dereferencing it libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:79:29: note: in definition of macro ‘STREQ’ # 1415| data->def->type == VIR_STORAGE_POOL_LOGICAL || # 1416| data->def->type == VIR_STORAGE_POOL_DISK || # 1417|-> data->def->type == VIR_STORAGE_POOL_ZFS) && # 1418| virStoragePoolObjSourceMatchTypeDEVICE(obj, data->def)) # 1419| return 1; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virstorageobj.c:1622:11: warning[deadcode.DeadStores]: Although the value stored to 'xml' is used in the enclosing expression, the value is never actually read from 'xml' # 1620| VIR_DEBUG("loading storage pool state XML '%s'", stateFile); # 1621| # 1622|-> if (!(xml = virXMLParseFileCtxt(stateFile, &ctxt))) # 1623| return NULL; # 1624| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/cpu/cpu.c:838:11: warning[deadcode.DeadStores]: Although the value stored to 'xml' is used in the enclosing expression, the value is never actually read from 'xml' # 836| VIR_DEBUG("xmlStr=%s", xmlStr); # 837| # 838|-> if (!(xml = virXMLParseStringCtxt(xmlStr, _("CPU data"), &ctxt))) { # 839| virReportError(VIR_ERR_INTERNAL_ERROR, "%s", # 840| _("cannot parse CPU data")); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/cpu/cpu_arm.c:309:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'vendor' # 307| # 308| if (virCPUarmVendorFindByName(map, vendor->name)) { # 309|-> virReportError(VIR_ERR_INTERNAL_ERROR, # 310| _("CPU vendor %1$s already defined"), # 311| vendor->name); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/cpu/cpu_arm.c:375:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'model' # 373| # 374| if (virCPUarmModelFind(map, model->name)) { # 375|-> virReportError(VIR_ERR_INTERNAL_ERROR, # 376| _("CPU model %1$s already defined"), # 377| model->name); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/cpu/cpu_ppc64.c:288:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'vendor' # 286| # 287| if (ppc64VendorFind(map, vendor->name)) { # 288|-> virReportError(VIR_ERR_INTERNAL_ERROR, # 289| _("CPU vendor %1$s already defined"), vendor->name); # 290| return -1; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/cpu/cpu_ppc64.c:315:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'model' # 313| # 314| if (ppc64ModelFind(map, model->name)) { # 315|-> virReportError(VIR_ERR_INTERNAL_ERROR, # 316| _("CPU model %1$s already defined"), model->name); # 317| return -1; Error: GCC_ANALYZER_WARNING (CWE-457): libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_driver.c: scope_hint: In function ‘esxConnectListAllDomains’ libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_driver.c:4812:27: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘powerState’ libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_driver.c:26: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_driver.c:4716:5: note: in expansion of macro ‘virCheckFlags’ libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_driver.c:4737:9: note: in expansion of macro ‘MATCH’ libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_driver.c:4751:20: note: in expansion of macro ‘MATCH’ libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_driver.c:4810:13: note: in expansion of macro ‘MATCH’ libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_driver.c:4811:16: note: in expansion of macro ‘MATCH’ # 4810| if (MATCH(VIR_CONNECT_LIST_DOMAINS_FILTERS_ACTIVE) && # 4811| !((MATCH(VIR_CONNECT_LIST_DOMAINS_ACTIVE) && # 4812|-> powerState != esxVI_VirtualMachinePowerState_PoweredOff) || # 4813| (MATCH(VIR_CONNECT_LIST_DOMAINS_INACTIVE) && # 4814| powerState == esxVI_VirtualMachinePowerState_PoweredOff))) Error: GCC_ANALYZER_WARNING (CWE-457): libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_driver.c:4814:27: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘powerState’ libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_driver.c:4716:5: note: in expansion of macro ‘virCheckFlags’ libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_driver.c:4737:9: note: in expansion of macro ‘MATCH’ libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_driver.c:4751:20: note: in expansion of macro ‘MATCH’ libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_driver.c:4810:13: note: in expansion of macro ‘MATCH’ libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_driver.c:4811:16: note: in expansion of macro ‘MATCH’ libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_driver.c:4813:16: note: in expansion of macro ‘MATCH’ # 4812| powerState != esxVI_VirtualMachinePowerState_PoweredOff) || # 4813| (MATCH(VIR_CONNECT_LIST_DOMAINS_INACTIVE) && # 4814|-> powerState == esxVI_VirtualMachinePowerState_PoweredOff))) # 4815| continue; # 4816| Error: GCC_ANALYZER_WARNING (CWE-457): libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_driver.c:4866:21: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘powerState’ libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_driver.c:4716:5: note: in expansion of macro ‘virCheckFlags’ libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_driver.c:4737:9: note: in expansion of macro ‘MATCH’ libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_driver.c:4751:20: note: in expansion of macro ‘MATCH’ libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_driver.c:4810:13: note: in expansion of macro ‘MATCH’ libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_driver.c:4865:13: note: in expansion of macro ‘MATCH’ # 4864| /* filter by domain state */ # 4865| if (MATCH(VIR_CONNECT_LIST_DOMAINS_FILTERS_STATE)) { # 4866|-> state = esxVI_VirtualMachinePowerState_ConvertToLibvirt(powerState); # 4867| # 4868| if (!((MATCH(VIR_CONNECT_LIST_DOMAINS_RUNNING) && Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_network_driver.c:806:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'def' # 804| # 805| cleanup: # 806|-> esxVI_HostVirtualSwitch_Free(&hostVirtualSwitch); # 807| esxVI_PhysicalNic_Free(&physicalNicList); # 808| esxVI_HostPortGroup_Free(&hostPortGroupList); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_storage_backend_vmfs.c:1009:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'key' # 1007| # 1008| cleanup: # 1009|-> if (virtualDiskSpec) { # 1010| virtualDiskSpec->diskType = NULL; # 1011| virtualDiskSpec->adapterType = NULL; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_storage_backend_vmfs.c:1175:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'key' # 1173| # 1174| cleanup: # 1175|-> esxVI_FileInfo_Free(&fileInfo); # 1176| esxVI_ManagedObjectReference_Free(&task); # 1177| return volume; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_util.c:306:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'address' # 304| # 305| if (errcode != 0) { # 306|-> virReportError(VIR_ERR_INTERNAL_ERROR, # 307| _("Formatting IP address for host '%1$s' failed: %2$s"), hostname, # 308| gai_strerror(errcode)); Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_util.c: scope_hint: In function ‘esxUtil_ReplaceSpecialWindowsPathChars’ libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_util.c:403:12: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘tmp’ libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_util.c:424:16: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_util.c: scope_hint: In function ‘esxUtil_ReplaceSpecialWindowsPathChars’ # 401| size_t length; # 402| # 403|-> while (*tmp != '\0') { # 404| length = strspn(tmp, specials); # 405| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/hyperv/hyperv_driver.c:816:45: warning[core.NullDereference]: Access to field 'data' results in a dereference of a null pointer (loaded from variable 'driveSettings') # 814| return -1; # 815| # 816|-> vhdInstanceIdEscaped = virStringReplace(driveSettings->data->InstanceID, "\\", "\\\\"); # 817| vfd__PATH = g_strdup_printf("\\\\%s\\Root\\Virtualization\\V2:" # 818| "Msvm_ResourceAllocationSettingData.InstanceID=\"%s\"", Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.4.0-build/libvirt-10.4.0/src/hyperv/hyperv_driver.c: scope_hint: In function ‘hypervDomainAttachFloppy’ libvirt-10.4.0-build/libvirt-10.4.0/src/hyperv/hyperv_driver.c:816:58: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘driveSettings’ /usr/include/glib-2.0/glib/gmacros.h:1358:7: note: in expansion of macro ‘_GLIB_AUTOPTR_CLEAR_FUNC_NAME’ /usr/include/glib-2.0/glib/gmacros.h:1372:3: note: in expansion of macro ‘_GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS’ libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/hyperv/hyperv_wmi_classes.generated.typedef:90:1: note: in expansion of macro ‘G_DEFINE_AUTOPTR_CLEANUP_FUNC’ libvirt-10.4.0-build/libvirt-10.4.0/src/hyperv/hyperv_driver.c: scope_hint: In function ‘hypervDomainAttachFloppy’ # 814| return -1; # 815| # 816|-> vhdInstanceIdEscaped = virStringReplace(driveSettings->data->InstanceID, "\\", "\\\\"); # 817| vfd__PATH = g_strdup_printf("\\\\%s\\Root\\Virtualization\\V2:" # 818| "Msvm_ResourceAllocationSettingData.InstanceID=\"%s\"", Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.4.0-build/libvirt-10.4.0/src/hyperv/hyperv_driver.c: scope_hint: In function ‘hypervDomainAttachStorage’ libvirt-10.4.0-build/libvirt-10.4.0/src/hyperv/hyperv_driver.c:881:33: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘domain’ /usr/include/glib-2.0/glib/gmacros.h:1358:7: note: in expansion of macro ‘_GLIB_AUTOPTR_CLEAR_FUNC_NAME’ /usr/include/glib-2.0/glib/gmacros.h:1372:3: note: in expansion of macro ‘_GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS’ libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/hyperv/hyperv_wmi_classes.generated.typedef:90:1: note: in expansion of macro ‘G_DEFINE_AUTOPTR_CLEANUP_FUNC’ libvirt-10.4.0-build/libvirt-10.4.0/src/hyperv/hyperv_driver.c: scope_hint: In function ‘hypervDomainAttachStorage’ # 879| hypervDomainAttachStorage(virDomainPtr domain, virDomainDef *def, const char *hostname) # 880| { # 881|-> hypervPrivate *priv = domain->conn->privateData; # 882| size_t i = 0; # 883| char uuid_string[VIR_UUID_STRING_BUFLEN]; Error: GCC_ANALYZER_WARNING (CWE-457): libvirt-10.4.0-build/libvirt-10.4.0/src/hyperv/hyperv_driver.c:928:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘ideChannels[ctrlr_idx]’ /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. /usr/include/glib-2.0/glib/gstrfuncs.h:324:38: note: in definition of macro ‘g_strdup’ # 926| case VIR_DOMAIN_DISK_BUS_IDE: # 927| ctrlr_idx = def->disks[i]->info.addr.drive.bus; # 928|-> if (hypervDomainAttachStorageVolume(domain, def->disks[i], # 929| ideChannels[ctrlr_idx], hostname) < 0) { # 930| return -1; Error: GCC_ANALYZER_WARNING (CWE-457): libvirt-10.4.0-build/libvirt-10.4.0/src/hyperv/hyperv_driver.c:935:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘scsiControllers[ctrlr_idx]’ /usr/include/glib-2.0/glib/gstrfuncs.h:324:38: note: in definition of macro ‘g_strdup’ # 933| case VIR_DOMAIN_DISK_BUS_SCSI: # 934| ctrlr_idx = def->disks[i]->info.addr.drive.controller; # 935|-> if (hypervDomainAttachStorageVolume(domain, def->disks[i], # 936| scsiControllers[ctrlr_idx], hostname) < 0) { # 937| return -1; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/hyperv/hyperv_driver.c:1227:28: warning[core.UndefinedBinaryOperatorResult]: The right operand of '==' is a garbage value # 1225| /* Find controller index */ # 1226| for (i = 0; i < maxControllers; i++) { # 1227|-> if (diskController == controllers[i]) { # 1228| ctrlr_idx = i; # 1229| break; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/hyperv/hyperv_driver.c:1401:28: warning[core.UndefinedBinaryOperatorResult]: The right operand of '==' is a garbage value # 1399| if (controller->data->ResourceType == MSVM_RASD_RESOURCETYPE_PARALLEL_SCSI_HBA) { # 1400| for (i = 0; i < HYPERV_MAX_SCSI_CONTROLLERS; i++) { # 1401|-> if (controller == scsiControllers[i]) { # 1402| ctrlr_idx = i; # 1403| break; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/hyperv/hyperv_driver.c:1413:28: warning[core.UndefinedBinaryOperatorResult]: The right operand of '==' is a garbage value # 1411| } else if (controller->data->ResourceType == MSVM_RASD_RESOURCETYPE_IDE_CONTROLLER) { # 1412| for (i = 0; i < HYPERV_MAX_IDE_CHANNELS; i++) { # 1413|-> if (controller == ideChannels[i]) { # 1414| ctrlr_idx = i; # 1415| break; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/hyperv/hyperv_driver.c:1590:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'ndef' # 1588| if (net->data->HostResource.count < 1 || !*switchConnection || # 1589| net->data->EnabledState == MSVM_ETHERNETPORTALLOCATIONSETTINGDATA_ENABLEDSTATE_DISABLED) { # 1590|-> VIR_DEBUG("Adapter not connected to switch"); # 1591| return 0; # 1592| } Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.4.0-build/libvirt-10.4.0/src/hyperv/hyperv_driver.c: scope_hint: In function ‘hypervDomainSetMemoryProperty’ libvirt-10.4.0-build/libvirt-10.4.0/src/hyperv/hyperv_driver.c:2245:33: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘domain’ /usr/include/glib-2.0/glib/gmacros.h:1358:7: note: in expansion of macro ‘_GLIB_AUTOPTR_CLEAR_FUNC_NAME’ /usr/include/glib-2.0/glib/gmacros.h:1372:3: note: in expansion of macro ‘_GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS’ libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/hyperv/hyperv_wmi_classes.generated.typedef:90:1: note: in expansion of macro ‘G_DEFINE_AUTOPTR_CLEANUP_FUNC’ libvirt-10.4.0-build/libvirt-10.4.0/src/hyperv/hyperv_driver.c: scope_hint: In function ‘hypervDomainSetMemoryProperty’ libvirt-10.4.0-build/libvirt-10.4.0/src/hyperv/hyperv_driver.c: scope_hint: In function ‘hypervDomainSetMemoryProperty’ # 2243| { # 2244| char uuid_string[VIR_UUID_STRING_BUFLEN]; # 2245|-> hypervPrivate *priv = domain->conn->privateData; # 2246| g_autoptr(Msvm_VirtualSystemSettingData) vssd = NULL; # 2247| g_autoptr(Msvm_MemorySettingData) memsd = NULL; Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.4.0-build/libvirt-10.4.0/src/hyperv/hyperv_driver.c: scope_hint: In function ‘hypervDomainSetVcpusFlags’ libvirt-10.4.0-build/libvirt-10.4.0/src/hyperv/hyperv_driver.c:2503:33: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘domain’ /usr/include/glib-2.0/glib/gmacros.h:1358:7: note: in expansion of macro ‘_GLIB_AUTOPTR_CLEAR_FUNC_NAME’ /usr/include/glib-2.0/glib/gmacros.h:1372:3: note: in expansion of macro ‘_GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS’ libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/src/hyperv/hyperv_wmi_classes.generated.typedef:90:1: note: in expansion of macro ‘G_DEFINE_AUTOPTR_CLEANUP_FUNC’ libvirt-10.4.0-build/libvirt-10.4.0/src/hyperv/hyperv_driver.c: scope_hint: In function ‘hypervDomainSetVcpusFlags’ libvirt-10.4.0-build/libvirt-10.4.0/src/hyperv/hyperv_driver.c: scope_hint: In function ‘hypervDomainSetVcpusFlags’ # 2501| { # 2502| char uuid_string[VIR_UUID_STRING_BUFLEN]; # 2503|-> hypervPrivate *priv = domain->conn->privateData; # 2504| g_autoptr(Msvm_VirtualSystemSettingData) vssd = NULL; # 2505| g_autoptr(Msvm_ProcessorSettingData) proc_sd = NULL; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/hyperv/hyperv_driver.c:2778:12: warning[core.NonNullParamChecker]: Null pointer passed to 2nd parameter expecting 'nonnull' # 2776| # 2777| /* XXX xmlopts must be non-NULL */ # 2778|-> return virDomainDefFormat(def, NULL, virDomainDefFormatConvertXMLFlags(flags)); # 2779| } # 2780| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/hyperv/hyperv_driver.c:3604:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'translatedKeycodes' # 3602| # 3603| if (keycode < 0) { # 3604|-> virReportError(VIR_ERR_INTERNAL_ERROR, "%s", # 3605| _("Could not translate keycode")); # 3606| return -1; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/hyperv/hyperv_wmi.c:936:21: warning[unix.Malloc]: Potential leak of memory pointed to by 'tail' # 934| # 935| if (hypervVerifyResponse(priv->client, response, "pull") < 0) # 936|-> return -1; # 937| # 938| node = ws_xml_get_soap_body(response); Error: GCC_ANALYZER_WARNING (CWE-465): libvirt-10.4.0-build/libvirt-10.4.0/src/hyperv/hyperv_wmi.c: scope_hint: In function ‘hypervFreeObject.part.0’ libvirt-10.4.0-build/libvirt-10.4.0/src/hyperv/hyperv_wmi.c:1011:19: warning[-Wanalyzer-deref-before-check]: check of ‘object’ for NULL after already dereferencing it # 1009| serializerContext = wsmc_get_serialization_context(((hypervObject *)object)->priv->client); # 1010| # 1011|-> while (object != NULL) { # 1012| next = ((hypervObject *)object)->next; # 1013| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/hypervisor/domain_interface.c:397:22: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 395| ignore_value(virNetDevMidonetUnbindPort(vport)); # 396| } else if (vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH) { # 397|-> ignore_value(virNetDevOpenvswitchRemovePort(net->ifname)); # 398| } # 399| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/interface/interface_backend_udev.c:941:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'ifacedef' # 939| dev = udev_device_new_from_subsystem_sysname(udev, "net", name); # 940| if (!dev) { # 941|-> virReportError(VIR_ERR_NO_INTERFACE, # 942| _("couldn't find interface named '%1$s'"), name); # 943| goto error; Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/src/interface/interface_backend_udev.c: scope_hint: In function ‘udevGetIfaceDef’ libvirt-10.4.0-build/libvirt-10.4.0/src/interface/interface_backend_udev.c:990:27: warning[-Wanalyzer-null-argument]: use of NULL ‘name’ where non-null expected libvirt-10.4.0-build/libvirt-10.4.0/src/util/virlog.h:24: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/interface/interface_backend_udev.c:26: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/interface/interface_backend_udev.c:1034:5: note: in expansion of macro ‘virCheckFlags’ /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.4.0-build/libvirt-10.4.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:30: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/interface/interface_backend_udev.c:936:22: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/src/interface/interface_backend_udev.c: scope_hint: In function ‘udevGetIfaceDef’ libvirt-10.4.0-build/libvirt-10.4.0/src/interface/interface_backend_udev.c:947:21: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:28: included_from: Included from here. /usr/include/string.h:273:14: note: argument 1 of ‘strrchr’ must be non-null # 988| * to prevent false positives # 989| */ # 990|-> vlan_parent_dev = strrchr(name, '.'); # 991| if (vlan_parent_dev) # 992| ifacedef->type = VIR_INTERFACE_TYPE_VLAN; Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/src/util/vircgroupv1.c: scope_hint: In function ‘virCgroupV1DetectPlacement’ libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:79:22: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected libvirt-10.4.0-build/libvirt-10.4.0/src/util/vircgroupv1.c:368:26: note: in expansion of macro ‘STREQ’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/vircgroupv1.c:355:21: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/vircgroupv1.c: scope_hint: In function ‘virCgroupV1DetectPlacement’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/vircgroupv1.c:368:26: note: in expansion of macro ‘STREQ’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/vircgroupv1.c:368:26: note: in expansion of macro ‘STREQ’ /usr/include/string.h:156:12: note: argument 1 of ‘strcmp’ must be non-null # 77| # 78| /* String equality tests, suggested by Jim Meyering. */ # 79|-> #define STREQ(a, b) (strcmp(a, b) == 0) # 80| #define STRCASEEQ(a, b) (g_ascii_strcasecmp(a, b) == 0) # 81| #define STRNEQ(a, b) (strcmp(a, b) != 0) Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:81:23: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected libvirt-10.4.0-build/libvirt-10.4.0/src/conf/nwfilter_params.c:424:21: note: in expansion of macro ‘STRNEQ’ libvirt-10.4.0-build/libvirt-10.4.0/src/conf/nwfilter_params.c:416:13: note: in expansion of macro ‘STREQ’ libvirt-10.4.0-build/libvirt-10.4.0/src/conf/nwfilter_params.c:416:13: note: in expansion of macro ‘STREQ’ libvirt-10.4.0-build/libvirt-10.4.0/src/conf/nwfilter_params.c:416:13: note: in expansion of macro ‘STREQ’ libvirt-10.4.0-build/libvirt-10.4.0/src/conf/nwfilter_params.c:424:21: note: in expansion of macro ‘STRNEQ’ libvirt-10.4.0-build/libvirt-10.4.0/src/conf/nwfilter_params.c:424:21: note: in expansion of macro ‘STRNEQ’ libvirt-10.4.0-build/libvirt-10.4.0/src/conf/nwfilter_params.c:424:21: note: in expansion of macro ‘STRNEQ’ libvirt-10.4.0-build/libvirt-10.4.0/src/conf/nwfilter_params.c:424:21: note: in expansion of macro ‘STRNEQ’ libvirt-10.4.0-build/libvirt-10.4.0/src/conf/nwfilter_params.c:424:21: note: in expansion of macro ‘STRNEQ’ libvirt-10.4.0-build/libvirt-10.4.0/src/conf/nwfilter_params.c:424:21: note: in expansion of macro ‘STRNEQ’ /usr/include/string.h:156:12: note: argument 2 of ‘strcmp’ must be non-null # 79| #define STREQ(a, b) (strcmp(a, b) == 0) # 80| #define STRCASEEQ(a, b) (g_ascii_strcasecmp(a, b) == 0) # 81|-> #define STRNEQ(a, b) (strcmp(a, b) != 0) # 82| #define STRCASENEQ(a, b) (g_ascii_strcasecmp(a, b) != 0) # 83| #define STREQLEN(a, b, n) (strncmp(a, b, n) == 0) Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/src/util/viralloc.h:25: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/tests/testutils.h:23: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/tests/qemudomaincheckpointxml2xmltest.c:11: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/tests/qemudomaincheckpointxml2xmltest.c: scope_hint: In function ‘testCompareXMLToXMLFiles’ libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:81:23: warning[-Wanalyzer-null-argument]: use of NULL ‘outXmlData’ where non-null expected libvirt-10.4.0-build/libvirt-10.4.0/tests/qemudomaincheckpointxml2xmltest.c:92:9: note: in expansion of macro ‘STRNEQ’ libvirt-10.4.0-build/libvirt-10.4.0/tests/qemudomaincheckpointxml2xmltest.c:92:9: note: in expansion of macro ‘STRNEQ’ libvirt-10.4.0-build/libvirt-10.4.0/tests/qemudomaincheckpointxml2xmltest.c:92:9: note: in expansion of macro ‘STRNEQ’ libvirt-10.4.0-build/libvirt-10.4.0/tests/qemudomaincheckpointxml2xmltest.c:92:9: note: in expansion of macro ‘STRNEQ’ libvirt-10.4.0-build/libvirt-10.4.0/tests/qemudomaincheckpointxml2xmltest.c:6: included_from: Included from here. /usr/include/string.h:156:12: note: argument 1 of ‘strcmp’ must be non-null # 79| #define STREQ(a, b) (strcmp(a, b) == 0) # 80| #define STRCASEEQ(a, b) (g_ascii_strcasecmp(a, b) == 0) # 81|-> #define STRNEQ(a, b) (strcmp(a, b) != 0) # 82| #define STRCASENEQ(a, b) (g_ascii_strcasecmp(a, b) != 0) # 83| #define STREQLEN(a, b, n) (strncmp(a, b, n) == 0) Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/src/security/security_driver.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/security/security_selinux.c:28: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/security/security_selinux.c: scope_hint: In function ‘virSecuritySELinuxSetFilecon’ libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:81:23: warning[-Wanalyzer-null-argument]: use of NULL ‘tcon’ where non-null expected libvirt-10.4.0-build/libvirt-10.4.0/src/security/security_selinux.c:1390:21: note: in expansion of macro ‘STRNEQ’ /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.4.0-build/libvirt-10.4.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:30: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/security/security_selinux.c:120:18: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/src/security/security_selinux.c: scope_hint: In function ‘virSecuritySELinuxSetFilecon’ libvirt-10.4.0-build/libvirt-10.4.0/src/security/security_selinux.c: scope_hint: In function ‘virSecuritySELinuxSetFilecon’ libvirt-10.4.0-build/libvirt-10.4.0/src/security/security_selinux.c:1390:21: note: in expansion of macro ‘STRNEQ’ libvirt-10.4.0-build/libvirt-10.4.0/src/security/security_selinux.c:1390:21: note: in expansion of macro ‘STRNEQ’ libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:28: included_from: Included from here. /usr/include/string.h:156:12: note: argument 2 of ‘strcmp’ must be non-null # 79| #define STREQ(a, b) (strcmp(a, b) == 0) # 80| #define STRCASEEQ(a, b) (g_ascii_strcasecmp(a, b) == 0) # 81|-> #define STRNEQ(a, b) (strcmp(a, b) != 0) # 82| #define STRCASENEQ(a, b) (g_ascii_strcasecmp(a, b) != 0) # 83| #define STREQLEN(a, b, n) (strncmp(a, b, n) == 0) Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virchrdev.h:24: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virchrdev.c:28: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virchrdev.c: scope_hint: In function ‘virChrdevLockFilePath’ libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:87:26: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:89:24: note: in expansion of macro ‘STRPREFIX’ libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virchrdev.c:77:16: note: in expansion of macro ‘STRSKIP’ /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.4.0-build/libvirt-10.4.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:30: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virchrdev.c:74:15: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virchrdev.c: scope_hint: In function ‘virChrdevLockFilePath’ libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:89:24: note: in expansion of macro ‘STRPREFIX’ libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virchrdev.c:77:16: note: in expansion of macro ‘STRSKIP’ libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:89:24: note: in expansion of macro ‘STRPREFIX’ libvirt-10.4.0-build/libvirt-10.4.0/src/conf/virchrdev.c:77:16: note: in expansion of macro ‘STRSKIP’ libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:28: included_from: Included from here. /usr/include/string.h:159:12: note: argument 1 of ‘strncmp’ must be non-null # 85| #define STRNEQLEN(a, b, n) (strncmp(a, b, n) != 0) # 86| #define STRCASENEQLEN(a, b, n) (g_ascii_strncasecmp(a, b, n) != 0) # 87|-> #define STRPREFIX(a, b) (strncmp(a, b, strlen(b)) == 0) # 88| #define STRCASEPREFIX(a, b) (g_ascii_strncasecmp(a, b, strlen(b)) == 0) # 89| #define STRSKIP(a, b) (STRPREFIX(a, b) ? (a) + strlen(b) : NULL) Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virenum.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virconf.h:23: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/xen_xl.c:26: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/xen_xl.c: scope_hint: In function ‘xenParseXLChannel’ libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:87:26: warning[-Wanalyzer-null-argument]: use of NULL ‘type’ where non-null expected libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/xen_xl.c:993:17: note: in expansion of macro ‘STRPREFIX’ libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/xen_xl.c:975:37: note: in expansion of macro ‘STRPREFIX’ libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/xen_xl.c:978:37: note: in expansion of macro ‘STRPREFIX’ libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/xen_xl.c:993:17: note: in expansion of macro ‘STRPREFIX’ libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/xen_xl.c:993:17: note: in expansion of macro ‘STRPREFIX’ /usr/include/libxl.h:804: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/xen_xl.c:24: included_from: Included from here. /usr/include/string.h:159:12: note: argument 1 of ‘strncmp’ must be non-null # 85| #define STRNEQLEN(a, b, n) (strncmp(a, b, n) != 0) # 86| #define STRCASENEQLEN(a, b, n) (g_ascii_strncasecmp(a, b, n) != 0) # 87|-> #define STRPREFIX(a, b) (strncmp(a, b, strlen(b)) == 0) # 88| #define STRCASEPREFIX(a, b) (g_ascii_strncasecmp(a, b, strlen(b)) == 0) # 89| #define STRSKIP(a, b) (STRPREFIX(a, b) ? (a) + strlen(b) : NULL) Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_util.c:26: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_util.c: scope_hint: In function ‘esxUtil_ParseDatastorePath’ libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:87:26: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘saveptr’ libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:89:24: note: in expansion of macro ‘STRPREFIX’ libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_util.c:219:17: note: in expansion of macro ‘STRSKIP’ /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.4.0-build/libvirt-10.4.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:30: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_util.c:216:27: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_util.c: scope_hint: In function ‘esxUtil_ParseDatastorePath’ libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:89:24: note: in expansion of macro ‘STRPREFIX’ libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_util.c:219:17: note: in expansion of macro ‘STRSKIP’ libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:89:24: note: in expansion of macro ‘STRPREFIX’ libvirt-10.4.0-build/libvirt-10.4.0/src/esx/esx_util.c:219:17: note: in expansion of macro ‘STRSKIP’ # 85| #define STRNEQLEN(a, b, n) (strncmp(a, b, n) != 0) # 86| #define STRCASENEQLEN(a, b, n) (g_ascii_strncasecmp(a, b, n) != 0) # 87|-> #define STRPREFIX(a, b) (strncmp(a, b, strlen(b)) == 0) # 88| #define STRCASEPREFIX(a, b) (g_ascii_strncasecmp(a, b, strlen(b)) == 0) # 89| #define STRSKIP(a, b) (STRPREFIX(a, b) ? (a) + strlen(b) : NULL) Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libvirt-stream.c:766:21: warning[unix.Malloc]: Potential leak of memory pointed to by 'bytes' # 764| if (!dataLen) { # 765| if (holeHandler(stream, &inData, §ionLen, opaque) < 0) { # 766|-> if (errno == 0) # 767| errno = EIO; # 768| virReportSystemError(errno, "%s", _("send holeHandler failed")); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_capabilities.c:262:30: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 260| if (cpus[node][j].socket_id == cpu_topo[i].socket && # 261| cpus[node][j].core_id == cpu_topo[i].core) # 262|-> ignore_value(virBitmapSetBit(cpus[node][j].siblings, i)); # 263| } # 264| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_conf.c:225:14: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'buf') # 223| case VIR_DOMAIN_CHR_TYPE_VC: # 224| case VIR_DOMAIN_CHR_TYPE_PTY: # 225|-> *buf = g_strdup(type); # 226| break; # 227| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_conf.c:230:14: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'buf') # 228| case VIR_DOMAIN_CHR_TYPE_FILE: # 229| case VIR_DOMAIN_CHR_TYPE_PIPE: # 230|-> *buf = g_strdup_printf("%s:%s", type, srcdef->data.file.path); # 231| break; # 232| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_conf.c:234:14: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'buf') # 232| # 233| case VIR_DOMAIN_CHR_TYPE_DEV: # 234|-> *buf = g_strdup(srcdef->data.file.path); # 235| break; # 236| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_conf.c:249:14: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'buf') # 247| bindService = "0"; # 248| # 249|-> *buf = g_strdup_printf("udp:%s:%s@%s:%s", connectHost, # 250| srcdef->data.udp.connectService, bindHost, bindService); # 251| break; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_conf.c:262:14: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'buf') # 260| prefix = "tcp"; # 261| # 262|-> *buf = g_strdup_printf("%s:%s:%s%s", prefix, srcdef->data.tcp.host, # 263| srcdef->data.tcp.service, # 264| srcdef->data.tcp.listen ? ",server,nowait" : ""); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_conf.c:269:14: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'buf') # 267| # 268| case VIR_DOMAIN_CHR_TYPE_UNIX: # 269|-> *buf = g_strdup_printf("unix:%s%s", srcdef->data.nix.path, # 270| srcdef->data.nix.listen ? ",server,nowait" : ""); # 271| break; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_conf.c:695:43: warning[unix.Malloc]: Potential leak of memory pointed to by '__p' # 693| return -1; # 694| } else { # 695|-> b_info->u.hvm.serial_list = *g_new0(libxl_string_list, def->nserials + 1); # 696| for (i = 0; i < def->nserials; i++) { # 697| if (libxlMakeChrdevStr(def->serials[i], Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_conf.c:704:46: warning[core.NullDereference]: Array access (via field 'serial_list') results in a null pointer dereference # 702| } # 703| } # 704|-> b_info->u.hvm.serial_list[i] = NULL; # 705| } # 706| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_driver.c:2538:11: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 2536| virBitmapSetAll(hostcpus); # 2537| # 2538|-> ret = virDomainDefGetVcpuPinInfoHelper(targetDef, maplen, ncpumaps, cpumaps, # 2539| hostcpus, NULL); # 2540| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_driver.c:4760:5: warning[deadcode.DeadStores]: Value stored to 'flags' is never read # 4758| # 4759| /* We don't return strings, and thus trivially support this flag. */ # 4760|-> flags &= ~VIR_TYPED_PARAM_STRING_OKAY; # 4761| # 4762| if (!(vm = libxlDomObjFromDomain(dom))) Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_driver.c:4993:5: warning[deadcode.DeadStores]: Value stored to 'flags' is never read # 4991| /* We blindly return a string, and let libvirt.c and remote_driver.c do # 4992| * the filtering on behalf of older clients that can't parse it. */ # 4993|-> flags &= ~VIR_TYPED_PARAM_STRING_OKAY; # 4994| # 4995| libxl_bitmap_init(&nodemap); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_driver.c:5719:5: warning[deadcode.DeadStores]: Value stored to 'flags' is never read # 5717| virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1); # 5718| # 5719|-> flags &= ~VIR_TYPED_PARAM_STRING_OKAY; # 5720| # 5721| if (!(vm = libxlDomObjFromDomain(dom))) Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_driver.c: scope_hint: In function ‘libxlGetDHCPInterfaces’ libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_driver.c:6295:51: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘iface’ # 6293| for (j = 0; j < n_leases; j++) { # 6294| virNetworkDHCPLeasePtr lease = leases[j]; # 6295|-> virDomainIPAddressPtr ip_addr = &iface->addrs[j]; # 6296| # 6297| ip_addr->addr = g_strdup(lease->ipaddr); Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_logger.c: scope_hint: In function ‘libxlLoggerNew’ libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_logger.c:156:34: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(g_strdup_printf("%s/libxl-driver.log", logDir), "a")’ # 154| path = g_strdup_printf("%s/libxl-driver.log", logDir); # 155| # 156|-> if ((logger.defaultLogFile = fopen(path, "a")) == NULL) # 157| return NULL; # 158| Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_logger.c:156:34: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(g_strdup_printf("%s/libxl-driver.log", logDir), "a")’ # 154| path = g_strdup_printf("%s/libxl-driver.log", logDir); # 155| # 156|-> if ((logger.defaultLogFile = fopen(path, "a")) == NULL) # 157| return NULL; # 158| Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_logger.c: scope_hint: In function ‘libxlLoggerOpenFile’ libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_logger.c:193:21: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(g_strdup_printf("%s/%s.log", *logger.logDir, name), "a")’ # 191| domidstr = g_strdup_printf("%d", id); # 192| # 193|-> if (!(logFile = fopen(path, "a"))) { # 194| VIR_WARN("Failed to open log file %s: %s", # 195| path, g_strerror(errno)); Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_logger.c:193:21: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(g_strdup_printf("%s/%s.log", *logger.logDir, name), "a")’ # 191| domidstr = g_strdup_printf("%d", id); # 192| # 193|-> if (!(logFile = fopen(path, "a"))) { # 194| VIR_WARN("Failed to open log file %s: %s", # 195| path, g_strerror(errno)); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_migration.c:175:11: warning[deadcode.DeadStores]: Although the value stored to 'doc' is used in the enclosing expression, the value is never actually read from 'doc' # 173| mig = g_new0(libxlMigrationCookie, 1); # 174| # 175|-> if (!(doc = virXMLParseStringCtxt(cookiein, # 176| _("(libxl_migration_cookie)"), # 177| &ctxt))) Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_migration.c:840:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'buffer' # 838| # 839| if (ret == 0) { # 840|-> VIR_DEBUG("poll returned 0"); # 841| break; # 842| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/xen_common.c:1042:17: warning[deadcode.DeadStores]: Although the value stored to 'vlanstr' is used in the enclosing expression, the value is never actually read from 'vlanstr' # 1040| net->virtPortProfile->virtPortType = VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH; # 1041| return 0; # 1042|-> } else if ((vlanstr = strchr(bridge, ':'))) { # 1043| /* 'bridge' string contains a bridge name and one or more vlan trunks */ # 1044| size_t i; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/xen_common.c:1585:20: warning[unix.Malloc]: Potential leak of memory pointed to by 'address_array' # 1583| address_array[i] = virSocketAddrFormat(&guestIP->ips[i]->address); # 1584| if (!address_array[i]) # 1585|-> return NULL; # 1586| } # 1587| return g_strjoinv(" ", address_array); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/xen_common.c:2334:12: warning[unix.Malloc]: Potential leak of memory pointed to by 'netVal' # 2332| return -1; # 2333| # 2334|-> return 0; # 2335| } # 2336| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/xen_xl.c:932:46: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 930| hostdev->managed = false; # 931| hostdev->source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB; # 932|-> hostdev->source.subsys.u.usb.bus = busNum; # 933| hostdev->source.subsys.u.usb.device = devNum; # 934| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/xen_xl.c:993:17: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 991| goto cleanup; # 992| # 993|-> if (STRPREFIX(type, "socket")) { # 994| channel->source->type = VIR_DOMAIN_CHR_TYPE_UNIX; # 995| channel->source->data.nix.listen = 1; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/xen_xl.c:1299:12: warning[unix.Malloc]: Potential leak of memory pointed to by 'cpuid_pairs' # 1297| } # 1298| # 1299|-> return 0; # 1300| } # 1301| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/xen_xl.c:1411:12: warning[unix.Malloc]: Potential leak of memory pointed to by 'vnumaVal' # 1409| return -1; # 1410| # 1411|-> return 0; # 1412| } # 1413| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/xen_xl.c:1658:12: warning[unix.Malloc]: Potential leak of memory pointed to by 'diskVal' # 1656| return -1; # 1657| # 1658|-> return 0; # 1659| } # 1660| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/xen_xl.c:1805:12: warning[unix.Malloc]: Potential leak of memory pointed to by 'usbdevices' # 1803| } # 1804| # 1805|-> return 0; # 1806| } # 1807| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/xen_xl.c:1848:29: warning[unix.Malloc]: Potential leak of memory pointed to by 'usbctrlVal' # 1846| # 1847| default: # 1848|-> return -1; # 1849| } # 1850| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/xen_xl.c:1998:12: warning[unix.Malloc]: Potential leak of memory pointed to by 'channelVal' # 1996| return -1; # 1997| # 1998|-> return 0; # 1999| } # 2000| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/xen_xm.c:197:13: warning[deadcode.DeadStores]: Value stored to 'src' is never read # 195| /* Strip the prefix we found off the source file name */ # 196| virDomainDiskSetSource(disk, src + len + 1); # 197|-> src = virDomainDiskGetSource(disk); # 198| } # 199| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/xen_xm.c:364:12: warning[unix.Malloc]: Potential leak of memory pointed to by 'diskVal' # 362| return -1; # 363| # 364|-> return 0; # 365| } # 366| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/locking/lock_daemon.c:689:11: warning[deadcode.DeadStores]: Although the value stored to 'pairs' is used in the enclosing expression, the value is never actually read from 'pairs' # 687| return -1; # 688| # 689|-> tmp = pairs = virHashGetItems(lockDaemon->lockspaces, NULL, false); # 690| while (tmp && tmp->key) { # 691| virLockSpace *lockspace = (virLockSpace *)tmp->value; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/locking/lock_daemon.c:1018:41: warning[core.NullDereference]: Access to field 'dmn' results in a dereference of a null pointer (loaded from variable 'lockDaemon') # 1016| } # 1017| # 1018|-> lockSrv = virNetDaemonGetServer(lockDaemon->dmn, "virtlockd"); # 1019| adminSrv = virNetDaemonGetServer(lockDaemon->dmn, "admin"); # 1020| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/locking/lock_daemon.c:1044:41: warning[core.NullDereference]: Access to field 'dmn' results in a dereference of a null pointer (loaded from variable 'lockDaemon') # 1042| } # 1043| } else { # 1044|-> lockSrv = virNetDaemonGetServer(lockDaemon->dmn, "virtlockd"); # 1045| /* If exec-restarting from old virtlockd, we won't have an # 1046| * admin server present */ Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/locking/lock_driver_sanlock.c:588:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'res' # 586| res->num_disks = 1; # 587| if (virCryptoHashString(VIR_CRYPTO_HASH_MD5, name, &hash) < 0) # 588|-> return -1; # 589| if (virStrcpy(res->name, hash, SANLK_NAME_LEN) < 0) { # 590| virReportError(VIR_ERR_INTERNAL_ERROR, Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/logging/log_daemon.c:821:40: warning[core.NullDereference]: Access to field 'dmn' results in a dereference of a null pointer (loaded from variable 'logDaemon') # 819| } # 820| # 821|-> logSrv = virNetDaemonGetServer(logDaemon->dmn, "virtlogd"); # 822| adminSrv = virNetDaemonGetServer(logDaemon->dmn, "admin"); # 823| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/logging/log_daemon.c:847:40: warning[core.NullDereference]: Access to field 'dmn' results in a dereference of a null pointer (loaded from variable 'logDaemon') # 845| } # 846| } else { # 847|-> logSrv = virNetDaemonGetServer(logDaemon->dmn, "virtlogd"); # 848| /* If exec-restarting from old virtlogd, we won't have an # 849| * admin server present */ Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/lxc/lxc_controller.c:2578:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'veths' # 2576| case 'h': # 2577| case '?': # 2578|-> fprintf(stderr, "\n"); # 2579| fprintf(stderr, "syntax: %s [OPTIONS]\n", argv[0]); # 2580| fprintf(stderr, "\n"); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/lxc/lxc_domain.c:367:26: warning[unix.Malloc]: Use of memory allocated with size zero # 365| } # 366| # 367|-> data.st_valid[i] = true; # 368| } # 369| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/lxc/lxc_driver.c:409:11: warning[deadcode.DeadStores]: Although the value stored to 'caps' is used in the enclosing expression, the value is never actually read from 'caps' # 407| parse_flags |= VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA; # 408| # 409|-> if (!(caps = virLXCDriverGetCapabilities(driver, false))) # 410| goto cleanup; # 411| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/lxc/lxc_driver.c:1078:11: warning[deadcode.DeadStores]: Although the value stored to 'caps' is used in the enclosing expression, the value is never actually read from 'caps' # 1076| parse_flags |= VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA; # 1077| # 1078|-> if (!(caps = virLXCDriverGetCapabilities(driver, false))) # 1079| goto cleanup; # 1080| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/lxc/lxc_driver.c:1813:11: warning[deadcode.DeadStores]: Although the value stored to 'caps' is used in the enclosing expression, the value is never actually read from 'caps' # 1811| goto cleanup; # 1812| # 1813|-> if (!(caps = virLXCDriverGetCapabilities(driver, false))) # 1814| goto cleanup; # 1815| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/lxc/lxc_driver.c:2101:5: warning[deadcode.DeadStores]: Value stored to 'flags' is never read # 2099| # 2100| /* We don't return strings, and thus trivially support this flag. */ # 2101|-> flags &= ~VIR_TYPED_PARAM_STRING_OKAY; # 2102| # 2103| if (!*nparams) { Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.4.0-build/libvirt-10.4.0/src/lxc/lxc_driver.c: scope_hint: In function ‘lxcDomainAttachDeviceConfig’ libvirt-10.4.0-build/libvirt-10.4.0/src/lxc/lxc_driver.c:2999:16: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘dev’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virerror.h:24: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/lxc/lxc_driver.c:37: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/lxc/lxc_driver.c:4416:5: note: in expansion of macro ‘virCheckFlags’ # 2997| virDomainHostdevDef *hostdev; # 2998| # 2999|-> switch (dev->type) { # 3000| case VIR_DOMAIN_DEVICE_DISK: # 3001| disk = dev->data.disk; Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.4.0-build/libvirt-10.4.0/src/lxc/lxc_driver.c: scope_hint: In function ‘lxcDomainDetachDeviceConfig’ libvirt-10.4.0-build/libvirt-10.4.0/src/lxc/lxc_driver.c:3145:16: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘dev’ libvirt-10.4.0-build/libvirt-10.4.0/src/lxc/lxc_driver.c:4579:5: note: in expansion of macro ‘virCheckFlags’ # 3143| int idx; # 3144| # 3145|-> switch (dev->type) { # 3146| case VIR_DOMAIN_DEVICE_DISK: # 3147| disk = dev->data.disk; Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.4.0-build/libvirt-10.4.0/src/lxc/lxc_driver.c: scope_hint: In function ‘lxcDomainAttachDeviceLive’ libvirt-10.4.0-build/libvirt-10.4.0/src/lxc/lxc_driver.c:3932:16: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘dev’ libvirt-10.4.0-build/libvirt-10.4.0/src/lxc/lxc_driver.c:4416:5: note: in expansion of macro ‘virCheckFlags’ # 3930| int ret = -1; # 3931| # 3932|-> switch (dev->type) { # 3933| case VIR_DOMAIN_DEVICE_DISK: # 3934| ret = lxcDomainAttachDeviceDiskLive(driver, vm, dev); Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.4.0-build/libvirt-10.4.0/src/lxc/lxc_driver.c: scope_hint: In function ‘lxcDomainDetachDeviceLive’ libvirt-10.4.0-build/libvirt-10.4.0/src/lxc/lxc_driver.c:4356:16: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘dev’ libvirt-10.4.0-build/libvirt-10.4.0/src/lxc/lxc_driver.c:4579:5: note: in expansion of macro ‘virCheckFlags’ # 4354| int ret = -1; # 4355| # 4356|-> switch (dev->type) { # 4357| case VIR_DOMAIN_DEVICE_DISK: # 4358| ret = lxcDomainDetachDeviceDiskLive(vm, dev); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/lxc/lxc_driver.c:4594:11: warning[deadcode.DeadStores]: Although the value stored to 'caps' is used in the enclosing expression, the value is never actually read from 'caps' # 4592| goto endjob; # 4593| # 4594|-> if (!(caps = virLXCDriverGetCapabilities(driver, false))) # 4595| goto endjob; # 4596| Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/src/lxc/lxc_fuse.c: scope_hint: In function ‘lxcProcReadMeminfo’ libvirt-10.4.0-build/libvirt-10.4.0/src/lxc/lxc_fuse.c:208:10: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(hostpath, "r")’ # 206| } # 207| # 208|-> fp = fopen(hostpath, "r"); # 209| if (fp == NULL) { # 210| virReportSystemError(errno, _("Cannot open %1$s"), hostpath); Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.4.0-build/libvirt-10.4.0/src/lxc/lxc_fuse.c:208:10: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(hostpath, "r")’ # 206| } # 207| # 208|-> fp = fopen(hostpath, "r"); # 209| if (fp == NULL) { # 210| virReportSystemError(errno, _("Cannot open %1$s"), hostpath); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/lxc/lxc_fuse.c:214:5: warning[deadcode.DeadStores]: Value stored to 'res' is never read # 212| } # 213| # 214|-> res = -1; # 215| while (getline(&line, &n, fp) > 0) { # 216| char *ptr = strchr(line, ':'); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/lxc/lxc_native.c:540:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'ip' # 538| virStrToLong_ui(ipparts[1], NULL, 10, &ip->prefix) < 0) { # 539| # 540|-> virReportError(VIR_ERR_INVALID_ARG, # 541| _("Invalid CIDR address: '%1$s'"), value->str); # 542| return -1; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/lxc/lxc_native.c:747:20: warning[core.NullDereference]: Array access (via field 'ips') results in a null pointer dereference # 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: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/lxc/lxc_process.c:1262:11: warning[deadcode.DeadStores]: Although the value stored to 'caps' is used in the enclosing expression, the value is never actually read from 'caps' # 1260| goto cleanup; # 1261| # 1262|-> if (!(caps = virLXCDriverGetCapabilities(driver, false))) # 1263| goto cleanup; # 1264| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/node_device/node_device_driver.c:1264:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'child' # 1262| * The value is an object describing the properties of the mdev */ # 1263| if (virJSONValueObjectKeysNumber(json) != 1) # 1264|-> return NULL; # 1265| # 1266| uuid = virJSONValueObjectGetKey(json, 0); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/node_device/node_device_driver.c:1898:11: warning[deadcode.DeadStores]: Although the value stored to 'mdevctl' is used in the enclosing expression, the value is never actually read from 'mdevctl' # 1896| size_t i; # 1897| # 1898|-> if (!(mdevctl = virFindFileInPath(MDEVCTL))) { # 1899| VIR_DEBUG(MDEVCTL " not found. Skipping update of mediated devices."); # 1900| return 0; Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.4.0-build/libvirt-10.4.0/src/node_device/node_device_driver.c: scope_hint: In function ‘nodeDeviceUpdateMediatedDevices’ libvirt-10.4.0-build/libvirt-10.4.0/src/node_device/node_device_driver.c:1916:13: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘defs’ # 1914| # 1915| for (i = 0; i < data.ndefs; i++) # 1916|-> if (nodeDeviceUpdateMediatedDevice(defs[i], true) < 0) # 1917| return -1; # 1918| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/nwfilter/nwfilter_dhcpsnoop.c:487:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'req' # 485| # 486| if (ifkey == NULL || strlen(ifkey) != VIR_IFKEY_LEN - 1) { # 487|-> virReportError(VIR_ERR_INTERNAL_ERROR, # 488| _("virNWFilterSnoopReqNew called with invalid key \"%1$s\" (%2$zu)"), # 489| NULLSTR_EMPTY(ifkey), Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/nwfilter/nwfilter_dhcpsnoop.c:1436:10: warning[deadcode.DeadStores]: Although the value stored to 'tmp' is used in the enclosing expression, the value is never actually read from 'tmp' # 1434| req->driver = driver; # 1435| req->techdriver = techdriver; # 1436|-> if ((tmp = virNetDevGetIndex(binding->portdevname, &req->ifindex)) < 0) # 1437| goto exit_snoopreqput; # 1438| if (!(req->binding = virNWFilterBindingDefCopy(binding))) Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/src/nwfilter/nwfilter_dhcpsnoop.c: scope_hint: In function ‘virNWFilterSnoopLeaseFileLoad’ libvirt-10.4.0-build/libvirt-10.4.0/src/nwfilter/nwfilter_dhcpsnoop.c:1727:10: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen("/run/libvirt/network/nwfilter.leases", "r")’ # 1725| VIR_LOCK_GUARD lock = virLockGuardLock(&virNWFilterSnoopState.snoopLock); # 1726| # 1727|-> fp = fopen(LEASEFILE, "r"); # 1728| time(&now); # 1729| while (fp && fgets(line, sizeof(line), fp)) { Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.4.0-build/libvirt-10.4.0/src/nwfilter/nwfilter_dhcpsnoop.c:1727:10: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen("/run/libvirt/network/nwfilter.leases", "r")’ # 1725| VIR_LOCK_GUARD lock = virLockGuardLock(&virNWFilterSnoopState.snoopLock); # 1726| # 1727|-> fp = fopen(LEASEFILE, "r"); # 1728| time(&now); # 1729| while (fp && fgets(line, sizeof(line), fp)) { Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/src/openvz/openvz_conf.c: scope_hint: In function ‘openvzWriteConfigParam’ libvirt-10.4.0-build/libvirt-10.4.0/src/openvz/openvz_conf.c:550:10: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(conf_file, "r")’ # 548| temp_file = g_strdup_printf("%s.tmp", conf_file); # 549| # 550|-> fp = fopen(conf_file, "r"); # 551| if (fp == NULL) # 552| goto error; Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.4.0-build/libvirt-10.4.0/src/openvz/openvz_conf.c:550:10: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(conf_file, "r")’ # 548| temp_file = g_strdup_printf("%s.tmp", conf_file); # 549| # 550|-> fp = fopen(conf_file, "r"); # 551| if (fp == NULL) # 552| goto error; Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/src/openvz/openvz_conf.c: scope_hint: In function ‘openvzReadConfigParam’ libvirt-10.4.0-build/libvirt-10.4.0/src/openvz/openvz_conf.c:620:10: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(conf_file, "r")’ # 618| char *sf, *token, *saveptr = NULL; # 619| # 620|-> fp = fopen(conf_file, "r"); # 621| if (fp == NULL) # 622| return -1; Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.4.0-build/libvirt-10.4.0/src/openvz/openvz_conf.c:620:10: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(conf_file, "r")’ # 618| char *sf, *token, *saveptr = NULL; # 619| # 620|-> fp = fopen(conf_file, "r"); # 621| if (fp == NULL) # 622| return -1; Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/src/openvz/openvz_conf.c: scope_hint: In function ‘openvz_copyfile’ libvirt-10.4.0-build/libvirt-10.4.0/src/openvz/openvz_conf.c:682:10: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(from_path, "r")’ # 680| int bytes_read; # 681| # 682|-> fp = fopen(from_path, "r"); # 683| if (fp == NULL) # 684| return -1; Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.4.0-build/libvirt-10.4.0/src/openvz/openvz_conf.c:682:10: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(from_path, "r")’ # 680| int bytes_read; # 681| # 682|-> fp = fopen(from_path, "r"); # 683| if (fp == NULL) # 684| return -1; Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/src/openvz/openvz_conf.c: scope_hint: In function ‘openvzGetVPSUUID’ libvirt-10.4.0-build/libvirt-10.4.0/src/openvz/openvz_conf.c:822:10: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(conf_file, "r")’ # 820| return -1; # 821| # 822|-> fp = fopen(conf_file, "r"); # 823| if (fp == NULL) # 824| goto cleanup; Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.4.0-build/libvirt-10.4.0/src/openvz/openvz_conf.c:822:10: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(conf_file, "r")’ # 820| return -1; # 821| # 822|-> fp = fopen(conf_file, "r"); # 823| if (fp == NULL) # 824| goto cleanup; Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/src/openvz/openvz_conf.c: scope_hint: In function ‘openvzSetDefinedUUID’ libvirt-10.4.0-build/libvirt-10.4.0/src/openvz/openvz_conf.c:876:14: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(conf_file, "a")’ # 874| # 875| if (uuidstr[0] == 0) { # 876|-> fp = fopen(conf_file, "a"); /* append */ # 877| if (fp == NULL) # 878| goto cleanup; Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.4.0-build/libvirt-10.4.0/src/openvz/openvz_conf.c:876:14: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(conf_file, "a")’ # 874| # 875| if (uuidstr[0] == 0) { # 876|-> fp = fopen(conf_file, "a"); /* append */ # 877| if (fp == NULL) # 878| goto cleanup; Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/src/openvz/openvz_driver.c: scope_hint: In function ‘openvzGetProcessInfo’ libvirt-10.4.0-build/libvirt-10.4.0/src/openvz/openvz_driver.c:1418:15: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen("/proc/vz/vestat", "r")’ # 1416| */ # 1417| # 1418|-> if ((fp = fopen("/proc/vz/vestat", "r")) == NULL) # 1419| return -1; # 1420| Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.4.0-build/libvirt-10.4.0/src/openvz/openvz_driver.c:1418:15: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen("/proc/vz/vestat", "r")’ # 1416| */ # 1417| # 1418|-> if ((fp = fopen("/proc/vz/vestat", "r")) == NULL) # 1419| return -1; # 1420| Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_block.c: scope_hint: In function ‘qemuBlockStorageSourceGetISCSIProps’ libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_block.c:608:19: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected /usr/lib64/glib-2.0/include/glibconfig.h:9: included_from: Included from here. /usr/include/glib-2.0/glib/gtypes.h:34: included_from: Included from here. /usr/include/glib-2.0/glib/galloca.h:34: included_from: Included from here. /usr/include/glib-2.0/glib.h:32: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:30: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_block.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_block.c:21: included_from: Included from here. /usr/include/glib-2.0/glib/gmacros.h:1358:7: note: in expansion of macro ‘_GLIB_AUTOPTR_CLEAR_FUNC_NAME’ /usr/include/glib-2.0/glib/gmacros.h:1372:3: note: in expansion of macro ‘_GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virjson.h:278:1: note: in expansion of macro ‘G_DEFINE_AUTOPTR_CLEANUP_FUNC’ /usr/include/glib-2.0/glib/gmacros.h:1372:3: note: in expansion of macro ‘_GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virjson.h:278:1: note: in expansion of macro ‘G_DEFINE_AUTOPTR_CLEANUP_FUNC’ /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.4.0-build/libvirt-10.4.0/src/qemu/qemu_block.c:605:14: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_block.c: scope_hint: In function ‘qemuBlockStorageSourceGetISCSIProps’ <built-in>: note: argument 1 of ‘__builtin_strchr’ must be non-null # 606| # 607| /* Separate the target and lun */ # 608|-> if ((lunStr = strchr(target, '/'))) { # 609| *(lunStr++) = '\0'; # 610| if (virStrToLong_ui(lunStr, NULL, 10, &lun) < 0) { Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_block.c:608:19: warning[-Wanalyzer-null-argument]: use of NULL ‘backingPath’ where non-null expected /usr/include/glib-2.0/glib/gmacros.h:1358:7: note: in expansion of macro ‘_GLIB_AUTOPTR_CLEAR_FUNC_NAME’ /usr/include/glib-2.0/glib/gmacros.h:1372:3: note: in expansion of macro ‘_GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virjson.h:278:1: note: in expansion of macro ‘G_DEFINE_AUTOPTR_CLEANUP_FUNC’ /usr/include/glib-2.0/glib/gmacros.h:1372:3: note: in expansion of macro ‘_GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virjson.h:278:1: note: in expansion of macro ‘G_DEFINE_AUTOPTR_CLEANUP_FUNC’ libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_block.c:605:14: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_block.c: scope_hint: In function ‘qemuBlockStorageSourceGetISCSIProps’ <built-in>: note: argument 1 of ‘__builtin_strchr’ must be non-null # 606| # 607| /* Separate the target and lun */ # 608|-> if ((lunStr = strchr(target, '/'))) { # 609| *(lunStr++) = '\0'; # 610| if (virStrToLong_ui(lunStr, NULL, 10, &lun) < 0) { Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_block.c:1552:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'data' # 1550| # 1551| if (!(data->storageProps = qemuBlockStorageSourceGetBackendProps(src, backendpropsflags))) # 1552|-> return NULL; # 1553| # 1554| data->storageNodeName = qemuBlockStorageSourceGetStorageNodename(src); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_block.c:1846:20: warning[unix.Malloc]: Potential leak of memory pointed to by 'data' # 1844| for (n = src; virStorageSourceIsBacking(n); n = n->backingStore) { # 1845| if (!(backend = qemuBlockStorageSourceDetachPrepare(n))) # 1846|-> return NULL; # 1847| # 1848| VIR_APPEND_ELEMENT(data->srcdata, data->nsrcdata, backend); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_block.c:2954:15: warning[deadcode.DeadStores]: Although the value stored to 'bitmap' is used in the enclosing expression, the value is never actually read from 'bitmap' # 2952| # 2953| if (dstbitmapname || # 2954|-> !(bitmap = qemuBlockNamedNodeDataGetBitmapByName(blockNamedNodeData, # 2955| target, curbitmap))) { # 2956| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_blockjob.c:1070:30: warning[core.NullDereference]: Access to field 'backingStore' results in a dereference of a null pointer (loaded from variable 'baseparent') # 1068| true, false, true); # 1069| # 1070|-> baseparent->backingStore = NULL; # 1071| job->data.commit.topparent->backingStore = job->data.commit.base; # 1072| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_blockjob.c:1152:34: warning[core.NullDereference]: Access to field 'readonly' results in a dereference of a null pointer (loaded from variable 'cfgtop') # 1150| cfgbase = g_steal_pointer(&cfgbaseparent->backingStore); # 1151| cfgdisk->src = cfgbase; # 1152|-> cfgdisk->src->readonly = cfgtop->readonly; # 1153| virObjectUnref(cfgtop); # 1154| } Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_blockjob.c: scope_hint: In function ‘qemuBlockJobProcessEventCompletedActiveCommit’ libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_blockjob.c:1160:30: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘baseparent’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virlog.h:88:5: note: in expansion of macro ‘VIR_DEBUG_INT’ libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_blockjob.c:1517:5: note: in expansion of macro ‘VIR_DEBUG’ # 1158| VIR_WARN("Unable to move disk metadata on vm %s", vm->def->name); # 1159| # 1160|-> baseparent->backingStore = NULL; # 1161| job->disk->src = job->data.commit.base; # 1162| job->disk->src->readonly = job->data.commit.top->readonly; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_blockjob.c:1160:30: warning[core.NullDereference]: Access to field 'backingStore' results in a dereference of a null pointer (loaded from variable 'baseparent') # 1158| VIR_WARN("Unable to move disk metadata on vm %s", vm->def->name); # 1159| # 1160|-> baseparent->backingStore = NULL; # 1161| job->disk->src = job->data.commit.base; # 1162| job->disk->src->readonly = job->data.commit.top->readonly; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_checkpoint.c:692:15: warning[unix.Malloc]: Potential leak of memory pointed to by 'diskmap' # 690| # 691| if (ndisks == 0) { # 692|-> ret = 0; # 693| goto endjob; # 694| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_firmware.c:324:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'interfaces' # 322| # 323| if ((tmp = qemuFirmwareOSInterfaceTypeFromString(tmpStr)) <= 0) { # 324|-> VIR_DEBUG("unknown interface type: '%s'", tmpStr); # 325| return -1; # 326| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_firmware.c:532:13: warning[unix.Malloc]: Potential leak of memory pointed to by 't' # 530| # 531| if (!(architectureStr = virJSONValueObjectGetString(item, "architecture"))) { # 532|-> VIR_DEBUG("missing 'architecture' in '%s'", path); # 533| goto cleanup; # 534| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_interface.c:273:17: warning[core.NonNullParamChecker]: Null pointer passed to 2nd parameter expecting 'nonnull' # 271| * using the MAC address from the interface config. # 272| */ # 273|-> if (virNetDevBridgePortSetLearning(brname, net->ifname, false) < 0) # 274| goto cleanup; # 275| if (virNetDevBridgePortSetUnicastFlood(brname, net->ifname, false) < 0) Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_migration_cookie.c:222:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'subject' # 220| } # 221| if (rc != 0) { # 222|-> virReportError(VIR_ERR_INTERNAL_ERROR, # 223| _("cannot get cert distinguished name: %1$s"), # 224| gnutls_strerror(rc)); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_migration_cookie.c:254:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'mig' # 252| if (cfg->spiceTLS && # 253| !(mig->tlsSubject = qemuDomainExtractTLSSubject(cfg->spiceTLSx509certdir))) # 254|-> return NULL; # 255| # 256| mig->listen = g_strdup(listenAddr); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_migration_cookie.c:290:25: warning[unix.Malloc]: Potential leak of memory pointed to by 'mig' # 288| if (virNetDevOpenvswitchGetMigrateData(&mig->net[i].portdata, # 289| netptr->ifname) != 0) { # 290|-> virReportError(VIR_ERR_INTERNAL_ERROR, # 291| _("Unable to run command to get OVS port data for interface %1$s"), # 292| netptr->ifname); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_migration_cookie.c:911:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'grap' # 909| # 910| if (!(graphicstype = virXPathString("string(./graphics/@type)", ctxt))) { # 911|-> virReportError(VIR_ERR_INTERNAL_ERROR, # 912| "%s", _("missing type attribute in migration data")); # 913| return NULL; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_migration_cookie.c:954:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'optr' # 952| # 953| if ((n = virXPathNodeSet("./network/interface", ctxt, &interfaces)) < 0) # 954|-> return NULL; # 955| # 956| optr->nnets = n; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_migration_cookie.c:1009:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'ret' # 1007| # 1008| if (!(ret->disks[i].target = virXPathString("string(./@target)", ctxt))) { # 1009|-> virReportError(VIR_ERR_INTERNAL_ERROR, "%s", # 1010| _("Malformed disk target")); # 1011| return NULL; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_migration_cookie.c:1129:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'caps' # 1127| # 1128| if ((n = virXPathNodeSet("./capabilities[1]/cap", ctxt, &nodes)) < 0) # 1129|-> return NULL; # 1130| # 1131| for (i = 0; i < n; i++) { Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_migration_cookie.c:1420:11: warning[deadcode.DeadStores]: Although the value stored to 'doc' is used in the enclosing expression, the value is never actually read from 'doc' # 1418| VIR_DEBUG("xml=%s", NULLSTR(xml)); # 1419| # 1420|-> if (!(doc = virXMLParseStringCtxt(xml, _("(qemu_migration_cookie)"), &ctxt))) # 1421| return -1; # 1422| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_monitor.c:254:5: warning[deadcode.DeadStores]: Value stored to 'monfd' is never read # 252| # 253| ret = monfd; # 254|-> monfd = -1; # 255| # 256| return ret; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_monitor.c:683:5: warning[deadcode.DeadStores]: Value stored to 'fd' is never read # 681| # 682| ret = qemuMonitorOpenInternal(vm, fd, context, cb); # 683|-> fd = -1; # 684| return ret; # 685| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_monitor_json.c:609:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'ret' # 607| virJSONValueObjectGetNumberUlong(data, "psw-addr", &psw_addr) < 0 || # 608| !(reason = virJSONValueObjectGetString(data, "reason"))) { # 609|-> virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("malformed s390 panic data")); # 610| return NULL; # 611| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_monitor_json.c:2587:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'bitmap' # 2585| # 2586| if (!(name = virJSONValueObjectGetString(val, "name"))) # 2587|-> return NULL; # 2588| # 2589| bitmap->name = g_strdup(name); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_monitor_json.c:2679:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'ent' # 2677| # 2678| broken: # 2679|-> virReportError(VIR_ERR_INTERNAL_ERROR, "%s", # 2680| _("query-named-block-nodes entry was not in expected format")); # 2681| return -1; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_monitor_json.c:3418:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'sets' # 3416| # 3417| if (!(entry = virJSONValueArrayGet(returnArray, i))) { # 3418|-> virReportError(VIR_ERR_INTERNAL_ERROR, "%s", # 3419| _("query-fdsets return data missing fdset array element")); # 3420| return -1; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_monitor_json.c:5068:17: warning[deadcode.DeadStores]: Value stored to 'typeStr' during its initialization is never read # 5066| g_autoptr(virJSONValue) cmd = NULL; # 5067| g_autoptr(virJSONValue) reply = NULL; # 5068|-> const char *typeStr = ""; # 5069| # 5070| switch (type) { Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_monitor_json.c:5636:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'proplist' # 5634| # 5635| if (!(tmp = virJSONValueObjectGetString(child, "name"))) { # 5636|-> virReportError(VIR_ERR_INTERNAL_ERROR, "%s", # 5637| _("reply data was missing 'name'")); # 5638| return -1; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_monitor_json.c:6042:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'capability' # 6040| # 6041| if (!(cmd = qemuMonitorJSONMakeCommand("query-sgx-capabilities", NULL))) # 6042|-> return -1; # 6043| # 6044| if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_namespace.c:852:13: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 850| #endif /* defined(__linux__) */ # 851| /* The path can be either a regular file or a dir. */ # 852|-> if (virFileIsDir(devMountsSavePath[i])) # 853| virFileDeleteTree(devMountsSavePath[i]); # 854| else Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_namespace.c: scope_hint: In function ‘qemuNamespaceUnlinkPaths’ libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_namespace.c:1454:41: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘mount’ libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_namespace.c: scope_hint: In function ‘qemuNamespaceUnlinkPaths’ /usr/include/glib-2.0/glib/glib-autocleanups.h:103:1: note: in expansion of macro ‘G_DEFINE_AUTO_CLEANUP_FREE_FUNC’ libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_namespace.c: scope_hint: In function ‘qemuNamespaceUnlinkPaths’ /usr/include/glib-2.0/glib/glib-autocleanups.h:103:1: note: in expansion of macro ‘G_DEFINE_AUTO_CLEANUP_FREE_FUNC’ libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_namespace.c: scope_hint: In function ‘qemuNamespaceUnlinkPaths’ # 1452| const char *const *devices = (const char *const *)cfg->cgroupDeviceACL; # 1453| # 1454|-> for (mount = devMountsPath; *mount; mount++) { # 1455| if (STREQ(*mount, "/dev")) # 1456| continue; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_namespace.c:1738:10: warning[deadcode.DeadStores]: Although the value stored to 'ret' is used in the enclosing expression, the value is never actually read from 'ret' # 1736| return -1; # 1737| # 1738|-> if ((ret = qemuNamespaceMknodPaths(vm, paths, created)) < 0) # 1739| return -1; # 1740| Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_nbdkit.c: scope_hint: In function ‘qemuNbdkitCapsQuery’ libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_nbdkit.c:252:9: warning[-Wanalyzer-null-argument]: use of NULL ‘*caps.path’ 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.4.0-build/libvirt-10.4.0/src/qemu/qemu_nbdkit.c:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_nbdkit.c:225:18: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_nbdkit.c: scope_hint: In function ‘qemuNbdkitCapsQuery’ /usr/include/features.h:511: included_from: Included from here. /usr/include/bits/libc-header-start.h:33: included_from: Included from here. /usr/include/limits.h:26: included_from: Included from here. /usr/lib/gcc/x86_64-redhat-linux/14/include/limits.h:210: included_from: Included from here. /usr/lib/gcc/x86_64-redhat-linux/14/include/syslimits.h:7: included_from: Included from here. /usr/lib/gcc/x86_64-redhat-linux/14/include/limits.h:34: included_from: Included from here. /usr/lib64/glib-2.0/include/glibconfig.h:11: included_from: Included from here. /usr/include/glib-2.0/glib/gtypes.h:34: included_from: Included from here. /usr/include/glib-2.0/glib/galloca.h:34: included_from: Included from here. /usr/include/glib-2.0/glib.h:32: included_from: Included from here. /usr/include/sys/stat.h:227:12: note: argument 1 of ‘stat’ must be non-null # 250| struct stat st; # 251| # 252|-> if (stat(caps->path, &st) < 0) { # 253| VIR_DEBUG("Failed to stat nbdkit binary '%s': %s", # 254| caps->path, Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_nbdkit.c:446:11: warning[deadcode.DeadStores]: Although the value stored to 'doc' is used in the enclosing expression, the value is never actually read from 'doc' # 444| long long int l; # 445| # 446|-> if (!(doc = virXMLParse(filename, NULL, NULL, "nbdkitCaps", &ctxt, NULL, false))) # 447| return -1; # 448| Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_nbdkit.c: scope_hint: In function ‘qemuNbdkitProcessStart’ libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_nbdkit.c:1259:19: warning[-Wanalyzer-malloc-leak]: leak of ‘nbd_create()’ # 1257| * provide a useful message to the user. # 1258| */ # 1259|-> nbd = nbd_create(); # 1260| if (nbd_connect_unix(nbd, proc->socketfile) < 0) { # 1261| VIR_WARN("nbd_connect_unix failed: %s", nbd_get_error()); Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_nbdkit.c:1260:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘nbd_create()’ where non-null expected libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_nbdkit.c:23: included_from: Included from here. /usr/include/libnbd.h:597:12: note: argument 1 of ‘nbd_connect_unix’ must be non-null # 1258| */ # 1259| nbd = nbd_create(); # 1260|-> if (nbd_connect_unix(nbd, proc->socketfile) < 0) { # 1261| VIR_WARN("nbd_connect_unix failed: %s", nbd_get_error()); # 1262| nbd_close(nbd); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_saveimage.c:176:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'zeros' # 174| # 175| if (safewrite(fd, header, sizeof(*header)) != sizeof(*header)) { # 176|-> virReportSystemError(errno, # 177| _("failed to write header to domain save file '%1$s'"), # 178| path); Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_snapshot.c: scope_hint: In function ‘qemuSnapshotRevertExternalActive’ libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_snapshot.c:2150:16: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘tmpsnapdef’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virmacaddr.h:23: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virebtables.h:24: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_conf.h:26: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_snapshot.h:22: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_snapshot.c:23: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_snapshot.c:2556:5: note: in expansion of macro ‘virCheckFlags’ libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_snapshot.c: scope_hint: In function ‘qemuSnapshotRevertExternalActive’ libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:81:33: note: in definition of macro ‘STRNEQ’ /usr/lib64/glib-2.0/include/glibconfig.h:9: included_from: Included from here. /usr/include/glib-2.0/glib/gtypes.h:34: included_from: Included from here. /usr/include/glib-2.0/glib/galloca.h:34: included_from: Included from here. /usr/include/glib-2.0/glib.h:32: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:30: included_from: Included from here. /usr/include/glib-2.0/glib/gmacros.h:1358:7: note: in expansion of macro ‘_GLIB_AUTOPTR_CLEAR_FUNC_NAME’ /usr/include/glib-2.0/glib/gmacros.h:1372:3: note: in expansion of macro ‘_GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS’ libvirt-10.4.0-build/libvirt-10.4.0/src/conf/domain_conf.h:3642:1: note: in expansion of macro ‘G_DEFINE_AUTOPTR_CLEANUP_FUNC’ /usr/include/glib-2.0/glib/gmacros.h:1372:3: note: in expansion of macro ‘_GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS’ libvirt-10.4.0-build/libvirt-10.4.0/src/conf/domain_conf.h:3642:1: note: in expansion of macro ‘G_DEFINE_AUTOPTR_CLEANUP_FUNC’ # 2148| g_autoptr(qemuSnapshotDiskContext) snapctxt = NULL; # 2149| # 2150|-> snapctxt = qemuSnapshotDiskContextNew(tmpsnapdef->ndisks, vm, VIR_ASYNC_JOB_SNAPSHOT); # 2151| # 2152| if (!(blockNamedNodeData = qemuBlockGetNamedNodeData(vm, VIR_ASYNC_JOB_SNAPSHOT))) Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_tpm.c:62:17: warning[deadcode.DeadStores]: Value stored to 'dir' during its initialization is never read # 60| { # 61| char *path = NULL; # 62|-> const char *dir = ""; # 63| # 64| switch (tpmversion) { Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_validate.c:2788:47: warning[core.NullDereference]: Array access (via field 'queues') results in a null pointer dereference # 2786| bool hasMapping; # 2787| # 2788|-> if (virBitmapGetBit(queueMap, ioth->queues[i], &hasMapping) < 0) { # 2789| virReportError(VIR_ERR_CONFIG_UNSUPPORTED, # 2790| _("disk iothread queue '%1$u' mapping out of range"), Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_vhost_user.c:200:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'vu' # 198| # 199| if (qemuVhostUserTypeParse(path, doc, vu) < 0) # 200|-> return NULL; # 201| # 202| if (qemuVhostUserBinaryParse(path, doc, vu) < 0) Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_vhost_user.c:323:24: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘vu’ libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_vhost_user.c: scope_hint: In function ‘qemuVhostUserFillDomainGPU’ # 321| size_t i; # 322| # 323|-> for (i = 0; i < gpu->nfeatures; i++) { # 324| if (gpu->features[i] == feature) # 325| return true; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/qemu/qemu_virtiofs.c:119:5: warning[deadcode.DeadStores]: Value stored to 'fd' is never read # 117| # 118| ret = fd; # 119|-> fd = -1; # 120| # 121| cleanup: Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/remote/remote_daemon_dispatch.c:174:18: warning[unix.Malloc]: Potential leak of memory pointed to by 'def' # 172| # 173| cleanup: # 174|-> ignore_value(virIdentitySetCurrent(NULL)); # 175| return ret; # 176| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/remote/remote_daemon_dispatch.c:200:18: warning[unix.Malloc]: Potential leak of memory pointed to by 'def' # 198| # 199| cleanup: # 200|-> ignore_value(virIdentitySetCurrent(NULL)); # 201| return ret; # 202| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/remote/remote_daemon_dispatch.c:226:18: warning[unix.Malloc]: Potential leak of memory pointed to by 'def' # 224| # 225| cleanup: # 226|-> ignore_value(virIdentitySetCurrent(NULL)); # 227| return ret; # 228| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/remote/remote_daemon_dispatch.c:251:18: warning[unix.Malloc]: Potential leak of memory pointed to by 'def' # 249| # 250| cleanup: # 251|-> ignore_value(virIdentitySetCurrent(NULL)); # 252| return ret; # 253| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/remote/remote_daemon_dispatch.c:278:18: warning[unix.Malloc]: Potential leak of memory pointed to by 'def' # 276| # 277| cleanup: # 278|-> ignore_value(virIdentitySetCurrent(NULL)); # 279| return ret; # 280| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/remote/remote_daemon_dispatch.c:303:18: warning[unix.Malloc]: Potential leak of memory pointed to by 'def' # 301| # 302| cleanup: # 303|-> ignore_value(virIdentitySetCurrent(NULL)); # 304| return ret; # 305| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/remote/remote_daemon_dispatch.c:4734:14: warning[unix.Malloc]: Potential leak of memory pointed to by 'infiles' # 4732| VIR_FORCE_CLOSE(infiles[i]); # 4733| # 4734|-> for (i = 0; i < noutfiles; i++) # 4735| VIR_FORCE_CLOSE(outfiles[i]); # 4736| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/rpc/virnetclient.c:1681:13: warning[deadcode.DeadStores]: Value stored to 'timeout' is never read # 1679| /* Limit timeout so that we can send keepalive request in time */ # 1680| if (timeout == -1) # 1681|-> timeout = virKeepAliveTimeout(client->keepalive); # 1682| # 1683| /* Calculate poll events for calls */ Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/rpc/virnetlibsshsession.c:687:9: warning[deadcode.DeadStores]: Value stored to 'ret' is never read # 685| } # 686| # 687|-> ret = SSH_AUTH_DENIED; # 688| # 689| switch (auth->method) { Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/src/rpc/virnetsocket.c: scope_hint: In function ‘virNetSocketNewConnectUNIX’ libvirt-10.4.0-build/libvirt-10.4.0/src/rpc/virnetsocket.c:754:9: warning[-Wanalyzer-null-argument]: use of NULL ‘lockpath’ where non-null expected libvirt-10.4.0-build/libvirt-10.4.0/src/rpc/virnetsocket.c:45: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virlog.h:88:5: note: in expansion of macro ‘VIR_DEBUG_INT’ libvirt-10.4.0-build/libvirt-10.4.0/src/rpc/virnetsocket.c:248:5: note: in expansion of macro ‘VIR_DEBUG’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virlog.h:81:72: note: in definition of macro ‘VIR_INFO_INT’ libvirt-10.4.0-build/libvirt-10.4.0/src/rpc/virnetsocket.c:303:5: note: in expansion of macro ‘PROBE’ libvirt-10.4.0-build/libvirt-10.4.0/src/rpc/virnetsocket.c:306:44: note: in expansion of macro ‘NULLSTR’ libvirt-10.4.0-build/libvirt-10.4.0/src/rpc/virnetsocket.c:25: included_from: Included from here. /usr/include/unistd.h:858:12: note: argument 1 of ‘unlink’ must be non-null # 752| cleanup: # 753| if (lockfd != -1) { # 754|-> unlink(lockpath); # 755| } # 756| Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/src/rpc/virnetsocket.c: scope_hint: In function ‘virNetSocketListen’ libvirt-10.4.0-build/libvirt-10.4.0/src/rpc/virnetsocket.c:2034:8: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘*sock.fd’ # 2032| { # 2033| virObjectLock(sock); # 2034|-> if (listen(sock->fd, backlog > 0 ? backlog : 30) < 0) { # 2035| virReportSystemError(errno, "%s", _("Unable to listen on socket")); # 2036| virObjectUnlock(sock); Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/src/rpc/virnetsocket.c:2039:5: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘*sock.fd’ # 2037| return -1; # 2038| } # 2039|-> virObjectUnlock(sock); # 2040| return 0; # 2041| } Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/src/rpc/virnetsshsession.c: scope_hint: In function ‘virNetSSHKbIntCb’ libvirt-10.4.0-build/libvirt-10.4.0/src/rpc/virnetsshsession.c:223:20: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected /usr/include/glib-2.0/glib/glist.h:34: included_from: Included from here. /usr/include/glib-2.0/glib/ghash.h:36: included_from: Included from here. /usr/include/glib-2.0/glib.h:52: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:30: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/rpc/virnetsshsession.h:23: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/rpc/virnetsshsession.c:24: included_from: Included from here. /usr/include/glib-2.0/glib/gmem.h:332:57: note: in expansion of macro ‘_G_NEW’ libvirt-10.4.0-build/libvirt-10.4.0/src/rpc/virnetsshsession.c:215:15: note: in expansion of macro ‘g_new0’ /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. /usr/include/glib-2.0/glib/gstrfuncs.h:324:38: note: in definition of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/src/rpc/virnetsshsession.c:219:29: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/src/rpc/virnetsshsession.c: scope_hint: In function ‘virNetSSHKbIntCb’ /usr/include/libssh2.h:101: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/rpc/virnetsshsession.c:21: included_from: Included from here. /usr/include/string.h:273:14: note: argument 1 of ‘strrchr’ must be non-null # 221| /* remove colon and trailing spaces from prompts, as default behavior # 222| * of libvirt's auth callback is to add them */ # 223|-> if ((tmp = strrchr(askcred[i].prompt, ':'))) # 224| *tmp = '\0'; # 225| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/rpc/virnettlscontext.c:986:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'dnameptr' # 984| # 985| if (gnutls_x509_crt_init(&cert) < 0) { # 986|-> virReportError(VIR_ERR_SYSTEM_ERROR, "%s", # 987| _("Unable to initialize certificate")); # 988| goto authfail; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/rpc/virnettlscontext.c:1013:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'dnameptr' # 1011| } # 1012| if (ret != 0) { # 1013|-> virReportError(VIR_ERR_SYSTEM_ERROR, # 1014| _("Failed to get certificate %1$s distinguished name: %2$s"), # 1015| "[session]", gnutls_strerror(ret)); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/security/security_dac.c:823:10: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 821| path = src->path; # 822| # 823|-> if (!virFileExists(path)) # 824| return 0; # 825| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/security/security_manager.c:1313:25: warning[core.NullDereference]: Array access (from variable 'paths') results in a null pointer dereference # 1311| # 1312| for (i = 0; i < npaths; i++) { # 1313|-> const char *p = paths[i]; # 1314| struct stat sb; # 1315| size_t j; Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_backend_fs.c: scope_hint: In function ‘virStorageBackendFileSystemIsMounted’ libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_backend_fs.c:247:17: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen("/etc/mtab", "r")’ # 245| g_autofree char *src = NULL; # 246| # 247|-> if ((mtab = fopen(_PATH_MOUNTED, "r")) == NULL) { # 248| virReportSystemError(errno, # 249| _("cannot read mount list '%1$s'"), Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_backend_fs.c:247:17: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen("/etc/mtab", "r")’ # 245| g_autofree char *src = NULL; # 246| # 247|-> if ((mtab = fopen(_PATH_MOUNTED, "r")) == NULL) { # 248| virReportSystemError(errno, # 249| _("cannot read mount list '%1$s'"), Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_backend_iscsi.c:245:10: warning[deadcode.DeadStores]: Although the value stored to 'session' is used in the enclosing expression, the value is never actually read from 'session' # 243| } # 244| # 245|-> if ((session = virStorageBackendISCSISession(pool, true))) # 246| *isActive = true; # 247| return 0; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_backend_iscsi.c:274:11: warning[deadcode.DeadStores]: Although the value stored to 'oldident' is used in the enclosing expression, the value is never actually read from 'oldident' # 272| } # 273| # 274|-> if (!(oldident = virIdentityElevateCurrent())) # 275| return -1; # 276| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_backend_iscsi.c:333:10: warning[deadcode.DeadStores]: Although the value stored to 'session' is used in the enclosing expression, the value is never actually read from 'session' # 331| } # 332| # 333|-> if ((session = virStorageBackendISCSISession(pool, true)) == NULL) { # 334| if ((portal = virStorageBackendISCSIPortal(&def->source)) == NULL) # 335| return -1; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_backend_iscsi.c:379:10: warning[deadcode.DeadStores]: Although the value stored to 'session' is used in the enclosing expression, the value is never actually read from 'session' # 377| g_autofree char *session = NULL; # 378| # 379|-> if ((session = virStorageBackendISCSISession(pool, true)) == NULL) # 380| return 0; # 381| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_backend_iscsi_direct.c:109:11: warning[deadcode.DeadStores]: Although the value stored to 'oldident' is used in the enclosing expression, the value is never actually read from 'oldident' # 107| } # 108| # 109|-> if (!(oldident = virIdentityElevateCurrent())) # 110| return -1; # 111| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_backend_iscsi_direct.c:315:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'vol' # 313| # 314| if (virISCSIDirectGetVolumeCapacity(iscsi, lun, &block_size, &nb_block) < 0) # 315|-> return -1; # 316| # 317| vol->target.capacity = block_size * nb_block; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_backend_iscsi_direct.c:486:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'list' # 484| g_autoptr(virStoragePoolSource) source = NULL; # 485| # 486|-> virCheckFlags(0, NULL); # 487| # 488| list->type = VIR_STORAGE_POOL_ISCSI_DIRECT; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_backend_iscsi_direct.c:535:12: warning[unix.Malloc]: Potential leak of memory pointed to by 'targets' # 533| } # 534| # 535|-> return virStoragePoolSourceListFormat(list); # 536| } # 537| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_backend_iscsi_direct.c:638:12: warning[unix.Malloc]: Potential leak of memory pointed to by 'data' # 636| } # 637| # 638|-> return 0; # 639| } # 640| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_backend_logical.c:171:8: warning[unix.Malloc]: Potential leak of memory pointed to by 'regex' # 169| } # 170| # 171|-> re = g_regex_new(regex, 0, 0, &err); # 172| if (!re) { # 173| virReportError(VIR_ERR_INTERNAL_ERROR, Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_backend_logical.c: scope_hint: In function ‘virStorageBackendLogicalMatchPoolSource’ libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_backend_logical.c:587:35: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘thisSource’ # 585| */ # 586| for (i = 0; i < def->source.ndevice; i++) { # 587|-> for (j = 0; j < thisSource->ndevice; j++) { # 588| if (STREQ(def->source.devices[i].path, # 589| thisSource->devices[j].path)) Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_backend_rbd.c:221:15: warning[deadcode.DeadStores]: Although the value stored to 'oldident' is used in the enclosing expression, the value is never actually read from 'oldident' # 219| } # 220| # 221|-> if (!(oldident = virIdentityElevateCurrent())) # 222| goto cleanup; # 223| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_backend_rbd.c:720:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'vol' # 718| */ # 719| if (rc < 0) { # 720|-> if (rc == -ENOENT || rc == -ETIMEDOUT) # 721| continue; # 722| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_backend_rbd.c:1325:12: warning[unix.Malloc]: Potential leak of memory pointed to by 'writebuf' # 1323| } # 1324| # 1325|-> return 0; # 1326| } # 1327| Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_backend_zfs.c: scope_hint: In function ‘virStorageBackendZFSRefreshPool’ libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_backend_zfs.c:248:16: warning[-Wanalyzer-null-argument]: use of NULL ‘zpool_props’ 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.4.0-build/libvirt-10.4.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:30: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/viralloc.h:25: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_backend_zfs.c:24: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_backend_zfs.c:235:29: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_backend_zfs.c: scope_hint: In function ‘virStorageBackendZFSRefreshPool’ <built-in>: note: argument 1 of ‘__builtin_strchr’ must be non-null # 246| * Here we just provide a list of properties we want to see # 247| */ # 248|-> if ((tmp = strchr(name, '/'))) # 249| *tmp = '\0'; # 250| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_util.c:155:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'buf' # 153| # 154| if (reflink_copy) { # 155|-> if (reflinkCloneFile(fd, inputfd) < 0) { # 156| virReportSystemError(errno, # 157| _("failed to clone files from '%1$s'"), Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_util.c:155:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'zerobuf' # 153| # 154| if (reflink_copy) { # 155|-> if (reflinkCloneFile(fd, inputfd) < 0) { # 156| virReportSystemError(errno, # 157| _("failed to clone files from '%1$s'"), Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_util.c:491:26: warning[deadcode.DeadStores]: Although the value stored to 'fd' is used in the enclosing expression, the value is never actually read from 'fd' # 489| int flags = VIR_FILE_OPEN_FORK | VIR_FILE_OPEN_FORCE_MODE; # 490| # 491|-> if ((fd = virFileOpenAs(vol->target.path, O_RDWR, mode, # 492| vol->target.perms->uid, # 493| vol->target.perms->gid, Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_util.c:1276:11: warning[deadcode.DeadStores]: Although the value stored to 'oldident' is used in the enclosing expression, the value is never actually read from 'oldident' # 1274| } # 1275| # 1276|-> if (!(oldident = virIdentityElevateCurrent())) # 1277| return NULL; # 1278| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_util.c:2569:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'writebuf' # 2567| if (!zero_end) { # 2568| if ((size = lseek(fd, 0, SEEK_SET)) < 0) { # 2569|-> virReportSystemError(errno, # 2570| _("Failed to seek to the start in volume with path '%1$s'"), # 2571| path); Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_util.c: scope_hint: In function ‘virStorageBackendBuildLocal’ libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_util.c:2785:15: warning[-Wanalyzer-null-argument]: use of NULL 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.4.0-build/libvirt-10.4.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:30: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/datatypes.h:24: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_util.c:46: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_util.c:2784:14: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_util.c: scope_hint: In function ‘virStorageBackendBuildLocal’ libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:28: included_from: Included from here. /usr/include/string.h:273:14: note: argument 1 of ‘strrchr’ must be non-null # 2783| # 2784| parent = g_strdup(def->target.path); # 2785|-> if (!(p = strrchr(parent, '/'))) { # 2786| virReportError(VIR_ERR_INVALID_ARG, # 2787| _("path '%1$s' is not absolute"), Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_util.c:2875:11: warning[deadcode.DeadStores]: Although the value stored to 'doc' is used in the enclosing expression, the value is never actually read from 'doc' # 2873| g_autofree char *volname = NULL; # 2874| # 2875|-> if (!(doc = virXMLParseStringCtxt(xml, _("(gluster_cli_output)"), &ctxt))) # 2876| return -1; # 2877| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/storage/storage_util.c:3705:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'vol' # 3703| devpath, # 3704| true)) == NULL) # 3705|-> return -1; # 3706| # 3707| if (STREQ(devpath, vol->target.path) && Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/storage_file/storage_file_probe.c:483:28: warning[unix.Malloc]: Potential leak of memory pointed to by 'tmp' # 481| * directly and thus the image is in fact still considered raw # 482| */ # 483|-> *backingFormat = virStorageFileFormatTypeFromString(tmp); # 484| if (*backingFormat <= VIR_STORAGE_FILE_NONE) # 485| *backingFormat = VIR_STORAGE_FILE_RAW; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/storage_file/storage_file_probe.c:586:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'desc' # 584| # 585| if (buf_size <= 0x200) # 586|-> return 0; # 587| # 588| len = buf_size - 0x200; Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/src/storage_file/storage_source_backingstore.c: scope_hint: In function ‘virStorageSourceParseNBDColonString’ libvirt-10.4.0-build/libvirt-10.4.0/src/storage_file/storage_source_backingstore.c:311:24: warning[-Wanalyzer-null-argument]: use of NULL 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.4.0-build/libvirt-10.4.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:30: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/storage_file/storage_source_backingstore.c:24: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/storage_file/storage_source_backingstore.c:294:28: note: in expansion of macro ‘g_strdup’ /usr/include/glib-2.0/glib/glist.h:34: included_from: Included from here. /usr/include/glib-2.0/glib/ghash.h:36: included_from: Included from here. /usr/include/glib-2.0/glib.h:52: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/storage_file/storage_source_backingstore.c: scope_hint: In function ‘virStorageSourceParseNBDColonString’ /usr/include/glib-2.0/glib/gmem.h:332:57: note: in expansion of macro ‘_G_NEW’ libvirt-10.4.0-build/libvirt-10.4.0/src/storage_file/storage_source_backingstore.c:300:18: note: in expansion of macro ‘g_new0’ <built-in>: note: argument 1 of ‘__builtin_strstr’ must be non-null # 309| # 310| /* first look for ':exportname=' and cut it off */ # 311|-> if ((export_name = strstr(nbd, ":exportname="))) { # 312| src->path = g_strdup(export_name + strlen(":exportname=")); # 313| export_name[0] = '\0'; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/storage_file/storage_source_backingstore.c:1107:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'nvme' # 1105| # 1106| if (!device || virPCIDeviceAddressParse((char *) device, &nvme->pciAddr) < 0) { # 1107|-> virReportError(VIR_ERR_INVALID_ARG, "%s", # 1108| _("missing or malformed 'device' field of 'nvme' storage")); # 1109| return -1; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/test/test_driver.c:687:15: warning[deadcode.DeadStores]: Although the value stored to 'net' is used in the enclosing expression, the value is never actually read from 'net' # 685| # 686| /* Generate network interface names */ # 687|-> if (!(net = virDomainNetFindByName(domdef, ifname))) # 688| return ifname; # 689| VIR_FREE(ifname); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/test/test_driver.c:1357:11: warning[deadcode.DeadStores]: Although the value stored to 'doc' is used in the enclosing expression, the value is never actually read from 'doc' # 1355| goto error; # 1356| # 1357|-> if (!(doc = virXMLParse(file, NULL, NULL, "node", &ctxt, NULL, false))) # 1358| goto error; # 1359| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/test/test_driver.c:1420:11: warning[deadcode.DeadStores]: Although the value stored to 'doc' is used in the enclosing expression, the value is never actually read from 'doc' # 1418| goto error; # 1419| # 1420|-> if (!(doc = virXMLParse(NULL, defaultConnXML, _("(test driver)"), # 1421| "node", &ctxt, NULL, false))) # 1422| goto error; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/test/test_driver.c:3712:20: warning[unix.Malloc]: Potential leak of memory pointed to by 'bandwidth' # 3710| VIR_FREE(net->bandwidth->out); # 3711| net->bandwidth->out = g_steal_pointer(&bandwidth->out); # 3712|-> } else if (outboundSpecified) { # 3713| /* if we got here it means user requested @outbound to be cleared */ # 3714| VIR_FREE(net->bandwidth->out); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/test/test_driver.c:5360:11: warning[deadcode.DeadStores]: Although the value stored to 'net' is used in the enclosing expression, the value is never actually read from 'net' # 5358| goto error; # 5359| # 5360|-> if (!(net = virDomainNetFind(privdom->def, device))) # 5361| goto error; # 5362| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/test/test_driver.c:9913:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'tmp' # 9911| if (!(tmp->dom = virGetDomain(conn, dom->def->name, # 9912| dom->def->uuid, dom->def->id))) # 9913|-> return -1; # 9914| # 9915| if (virTypedParamListSteal(params, &tmp->params, &tmp->nparams) < 0) Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c:27: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c: scope_hint: In function ‘virFirewallNewFromRollback’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/viralloc.h:116:5: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c:224:9: note: in expansion of macro ‘VIR_RESIZE_N’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c:990:17: note: in expansion of macro ‘ADD_ARG’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c:482:5: note: in expansion of macro ‘VIR_FIREWALL_RETURN_IF_ERROR’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c:482:5: note: in expansion of macro ‘VIR_FIREWALL_RETURN_IF_ERROR’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c:987:37: note: in expansion of macro ‘virFirewallAddCmd’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c:242:5: note: in expansion of macro ‘VIR_FIREWALL_RETURN_NULL_IF_ERROR’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c:242:5: note: in expansion of macro ‘VIR_FIREWALL_RETURN_NULL_IF_ERROR’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c:987:37: note: in expansion of macro ‘virFirewallAddCmd’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c:224:9: note: in expansion of macro ‘VIR_RESIZE_N’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c:990:17: note: in expansion of macro ‘ADD_ARG’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c:224:9: note: in expansion of macro ‘VIR_RESIZE_N’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c:990:17: note: in expansion of macro ‘ADD_ARG’ # 114| */ # 115| #define VIR_RESIZE_N(ptr, alloc, count, add) \ # 116|-> virResizeN(&(ptr), sizeof(*(ptr)), &(alloc), count, add) # 117| # 118| /** Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virarptable.c:87:14: warning[deadcode.DeadStores]: Although the value stored to 'len' is used in the enclosing expression, the value is never actually read from 'len' # 85| void *addr; # 86| # 87|-> if ((len -= NLMSG_LENGTH(sizeof(*nh))) < 0) { # 88| virReportError(VIR_ERR_INTERNAL_ERROR, "%s", # 89| _("wrong nlmsg len")); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virarptable.c:137:31: warning[core.NullDereference]: Dereference of null pointer # 135| virMacAddrFormat(&macaddr, ifmac); # 136| # 137|-> table->t[num].mac = g_strdup(ifmac); # 138| # 139| num++; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virauth.c:305:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'ret' # 303| # 304| if (ret->type == -1) { # 305|-> virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", # 306| _("no suitable callback authentication callback was found")); # 307| return NULL; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virauthconfig.c:47:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'auth' # 45| # 46| if (!g_key_file_load_from_file(auth->keyfile, path, 0, NULL)) # 47|-> return NULL; # 48| # 49| return g_steal_pointer(&auth); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virauthconfig.c:64:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'auth' # 62| # 63| if (!g_key_file_load_from_data(auth->keyfile, data, len, 0, NULL)) # 64|-> return NULL; # 65| # 66| return g_steal_pointer(&auth); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virbitmap.c:164:44: warning[core.NullDereference]: Array access (via field 'map') results in a null pointer dereference # 162| virBitmapExpand(bitmap, b); # 163| # 164|-> bitmap->map[VIR_BITMAP_UNIT_OFFSET(b)] |= VIR_BITMAP_BIT(b); # 165| } # 166| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virbitmap.c:204:48: warning[core.NullDereference]: Array access (via field 'map') results in a null pointer dereference # 202| virBitmapExpand(bitmap, b); # 203| } else { # 204|-> bitmap->map[VIR_BITMAP_UNIT_OFFSET(b)] &= ~VIR_BITMAP_BIT(b); # 205| } # 206| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virbitmap.c:568:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'tmp' # 566| # 567| if (virBitmapParseInternal(str, tmp, false, true) < 0) # 568|-> return NULL; # 569| # 570| return g_steal_pointer(&tmp); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virbitmap.c:585:5: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 583| virBitmap *dst = virBitmapNew(src->nbits); # 584| # 585|-> memcpy(dst->map, src->map, src->map_len * sizeof(src->map[0])); # 586| # 587| return dst; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virbitmap.c:620:12: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'p') # 618| p++; # 619| } # 620|-> *p |= (unsigned long) bytes[i] << (j * CHAR_BIT); # 621| } # 622| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virbitmap.c:1038:52: warning[core.NullDereference]: Array access (via field 'map') results in a null pointer dereference # 1036| unsigned long nibble = g_ascii_xdigit_value(string[len - i - 1]); # 1037| nibble <<= VIR_BITMAP_BIT_OFFSET(i * 4); # 1038|-> bitmap->map[VIR_BITMAP_UNIT_OFFSET(i * 4)] |= nibble; # 1039| } # 1040| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/vircgroup.c:750:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'newGroup' # 748| # 749| if (virCgroupSetBackends(newGroup) < 0) # 750|-> return -1; # 751| # 752| if (virCgroupDetectMounts(newGroup) < 0) Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/vircgroup.c:899:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'new' # 897| # 898| if (virCgroupSetBackends(new) < 0) # 899|-> return -1; # 900| # 901| if (virCgroupCopyMounts(new, parent) < 0) Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/vircgroup.c:1160:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'new' # 1158| # 1159| if (virCgroupSetBackends(new) < 0) # 1160|-> return -1; # 1161| # 1162| if (virCgroupDetectMounts(new) < 0) Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/vircgroup.c:2432:41: warning[unix.Malloc]: Use of memory allocated with size zero # 2430| VIR_DOMAIN_CPU_STATS_VCPUTIME, # 2431| VIR_TYPED_PARAM_ULLONG, # 2432|-> sum_cpu_time[i]) < 0) # 2433| return -1; # 2434| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/vircgroup.c:2436:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'sum_cpu_time' # 2434| } # 2435| # 2436|-> param_idx++; # 2437| } # 2438| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/vircgroup.c:2688:25: warning[unix.Malloc]: Potential leak of memory pointed to by 'pid_value' # 2686| # 2687| if (fscanf(fp, "%lld", pid_value) != 1) { # 2688|-> if (feof(fp)) # 2689| break; # 2690| virReportSystemError(errno, Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/src/util/vircgroupv1.c: scope_hint: In function ‘virCgroupV1ResolveMountLink’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/vircgroupv1.c:230:15: warning[-Wanalyzer-null-argument]: use of NULL 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.4.0-build/libvirt-10.4.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:30: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/vircgroupv1.c:30: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/vircgroupv1.c:228:11: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/vircgroupv1.c: scope_hint: In function ‘virCgroupV1ResolveMountLink’ libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:28: included_from: Included from here. /usr/include/string.h:273:14: note: argument 1 of ‘strrchr’ must be non-null # 228| tmp = g_strdup(mntDir); # 229| # 230|-> dirName = strrchr(tmp, '/'); # 231| if (!dirName) { # 232| virReportError(VIR_ERR_INTERNAL_ERROR, Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/vircgroupv2devices.c:322:5: warning[deadcode.DeadStores]: Value stored to 'progfd' is never read # 320| group->unified.devices.mapfd = mapfd; # 321| group->unified.devices.max = max; # 322|-> progfd = -1; # 323| mapfd = -1; # 324| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/vircgroupv2devices.c:500:5: warning[deadcode.DeadStores]: Value stored to 'newmapfd' is never read # 498| # 499| ret = newmapfd; # 500|-> newmapfd = -1; # 501| return ret; # 502| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/vircommand.c:2105:19: warning[deadcode.DeadStores]: Although the value stored to 'basename' is used in the enclosing expression, the value is never actually read from 'basename' # 2103| # 2104| if (stripCommandPath) # 2105|-> command = basename = g_path_get_basename(command); # 2106| # 2107| virBufferEscapeShell(buf, command); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/vircommand.c:2359:11: warning[unix.Malloc]: Potential leak of memory pointed to by 'fds' # 2357| } # 2358| # 2359|-> ret = 0; # 2360| cleanup: # 2361| if (cmd->outbuf && *cmd->outbuf) Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virconf.c:490:20: warning[core.NullDereference]: Access to field 'next' results in a dereference of a null pointer (loaded from variable 'prev') # 488| } # 489| prev = lst; # 490|-> while (prev->next != NULL) prev = prev->next; # 491| prev->next = tmp; # 492| SKIP_BLANKS_AND_EOL; Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virdaemon.c: scope_hint: In function ‘virDaemonForkIntoBackground’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virdaemon.c:66:16: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(stdinfd, 0)’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virdaemon.c: scope_hint: In function ‘virDaemonForkIntoBackground’ # 64| if ((stdoutfd = open("/dev/null", O_WRONLY)) < 0) # 65| goto cleanup; # 66|-> if (dup2(stdinfd, STDIN_FILENO) != STDIN_FILENO) # 67| goto cleanup; # 68| if (dup2(stdoutfd, STDOUT_FILENO) != STDOUT_FILENO) Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virdaemon.c:68:16: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(stdoutfd, 1)’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virdaemon.c: scope_hint: In function ‘virDaemonForkIntoBackground’ # 66| if (dup2(stdinfd, STDIN_FILENO) != STDIN_FILENO) # 67| goto cleanup; # 68|-> if (dup2(stdoutfd, STDOUT_FILENO) != STDOUT_FILENO) # 69| goto cleanup; # 70| if (dup2(stdoutfd, STDERR_FILENO) != STDERR_FILENO) Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virdaemon.c:70:16: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(stdoutfd, 2)’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virdaemon.c: scope_hint: In function ‘virDaemonForkIntoBackground’ # 68| if (dup2(stdoutfd, STDOUT_FILENO) != STDOUT_FILENO) # 69| goto cleanup; # 70|-> if (dup2(stdoutfd, STDERR_FILENO) != STDERR_FILENO) # 71| goto cleanup; # 72| if (VIR_CLOSE(stdinfd) < 0) Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virdevmapper.c:153:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'tmp' # 151| } # 152| # 153|-> if (dm.version[0] != DM_VERSION_MAJOR) { # 154| virReportError(VIR_ERR_OPERATION_UNSUPPORTED, # 155| _("Unsupported device-mapper version. Expected %1$d got %2$d"), Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virdevmapper.c:161:5: warning[deadcode.DeadStores]: Value stored to 'controlFD' is never read # 159| # 160| ret = controlFD; # 161|-> controlFD = -1; # 162| return ret; # 163| } Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virdnsmasq.c: scope_hint: In function ‘addnhostsWrite’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virdnsmasq.c:174:15: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(g_strdup_printf("%s.new", path), "w")’ # 172| tmp = g_strdup_printf("%s.new", path); # 173| # 174|-> if (!(f = fopen(tmp, "w"))) { # 175| istmp = false; # 176| if (!(f = fopen(path, "w"))) Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virdnsmasq.c:174:15: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(g_strdup_printf("%s.new", path), "w")’ # 172| tmp = g_strdup_printf("%s.new", path); # 173| # 174|-> if (!(f = fopen(tmp, "w"))) { # 175| istmp = false; # 176| if (!(f = fopen(path, "w"))) Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virdnsmasq.c:176:19: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(path, "w")’ # 174| if (!(f = fopen(tmp, "w"))) { # 175| istmp = false; # 176|-> if (!(f = fopen(path, "w"))) # 177| return -errno; # 178| } Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virdnsmasq.c:176:19: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(path, "w")’ # 174| if (!(f = fopen(tmp, "w"))) { # 175| istmp = false; # 176|-> if (!(f = fopen(path, "w"))) # 177| return -errno; # 178| } Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virdnsmasq.c: scope_hint: In function ‘hostsfileWrite’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virdnsmasq.c:366:15: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(g_strdup_printf("%s.new", path), "w")’ # 364| tmp = g_strdup_printf("%s.new", path); # 365| # 366|-> if (!(f = fopen(tmp, "w"))) { # 367| istmp = false; # 368| if (!(f = fopen(path, "w"))) Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virdnsmasq.c:366:15: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(g_strdup_printf("%s.new", path), "w")’ # 364| tmp = g_strdup_printf("%s.new", path); # 365| # 366|-> if (!(f = fopen(tmp, "w"))) { # 367| istmp = false; # 368| if (!(f = fopen(path, "w"))) Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virdnsmasq.c:368:19: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(path, "w")’ # 366| if (!(f = fopen(tmp, "w"))) { # 367| istmp = false; # 368|-> if (!(f = fopen(path, "w"))) # 369| return -errno; # 370| } Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virdnsmasq.c:368:19: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(path, "w")’ # 366| if (!(f = fopen(tmp, "w"))) { # 367| istmp = false; # 368|-> if (!(f = fopen(path, "w"))) # 369| return -errno; # 370| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virerror.c:669:17: warning[deadcode.DeadStores]: Value stored to 'lvl' during its initialization is never read # 667| virDefaultErrorFunc(virErrorPtr err) # 668| { # 669|-> const char *lvl = "", *dom = "", *domain = "", *network = ""; # 670| int len; # 671| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virerror.c:669:28: warning[deadcode.DeadStores]: Value stored to 'dom' during its initialization is never read # 667| virDefaultErrorFunc(virErrorPtr err) # 668| { # 669|-> const char *lvl = "", *dom = "", *domain = "", *network = ""; # 670| int len; # 671| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfdstream.c:488:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'msg' # 486| # 487| if ((got = saferead(fdin, buf, buflen)) < 0) { # 488|-> virReportSystemError(errno, # 489| _("Unable to read %1$s"), # 490| fdinname); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfdstream.c:562:21: warning[unix.Malloc]: Potential leak of memory pointed to by 'buf' # 560| # 561| if ((r = safewrite(fdout, buf, count)) < 0) { # 562|-> virReportSystemError(errno, # 563| _("Unable to write %1$s"), # 564| fdoutname); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfdstream.c:754:9: warning[deadcode.DeadStores]: Value stored to 'ret' is never read # 752| # 753| if (virFDStreamJoinWorker(fdst, streamAbort) < 0) # 754|-> ret = -1; # 755| # 756| /* mutex locked */ Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfdstream.c:1234:5: warning[deadcode.DeadStores]: Value stored to 'fd' is never read # 1232| if (virFDStreamOpenInternal(st, fd, NULL, 0) < 0) # 1233| return -1; # 1234|-> fd = -1; # 1235| # 1236| return 0; Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfdstream.c: scope_hint: In function ‘virFDStreamOpenFileInternal’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfdstream.c:1341:9: warning[-Wanalyzer-null-argument]: use of NULL ‘path’ where non-null expected libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfdstream.c: scope_hint: In function ‘virFDStreamOpenFileInternal’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfdstream.c:25: included_from: Included from here. /usr/include/glib-2.0/glib/glist.h:34: included_from: Included from here. /usr/include/glib-2.0/glib/ghash.h:36: included_from: Included from here. /usr/include/glib-2.0/glib.h:52: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:30: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfdstream.h:24: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfdstream.c:32: included_from: Included from here. /usr/include/glib-2.0/glib/gmem.h:332:57: note: in expansion of macro ‘_G_NEW’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfdstream.c:1307:22: note: in expansion of macro ‘g_new0’ /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.4.0-build/libvirt-10.4.0/src/util/virfdstream.c:1325:37: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfdstream.c: scope_hint: In function ‘virFDStreamOpenFileInternal’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfdstream.c:27: included_from: Included from here. /usr/include/unistd.h:858:12: note: argument 1 of ‘unlink’ must be non-null # 1339| VIR_FORCE_CLOSE(pipefds[1]); # 1340| if (oflags & O_CREAT) # 1341|-> unlink(path); # 1342| virFDStreamThreadDataFree(threadData); # 1343| return -1; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfile.c:693:10: warning[deadcode.DeadStores]: Although the value stored to 'rc' is used in the enclosing expression, the value is never actually read from 'rc' # 691| } # 692| # 693|-> if ((rc = rewrite(fd, newfile, opaque)) < 0) { # 694| goto cleanup; # 695| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfile.c:1102:14: warning[deadcode.DeadStores]: Although the value stored to 'errbuf' is used in the enclosing expression, the value is never actually read from 'errbuf' # 1100| g_autofree char *errbuf = NULL; # 1101| # 1102|-> if ((errbuf = virKModLoad(NBD_DRIVER))) { # 1103| virReportError(VIR_ERR_INTERNAL_ERROR, "%s", # 1104| _("Failed to load nbd module")); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfile.c:1412:21: warning[unix.Malloc]: Potential leak of memory pointed to by 'buf' # 1410| r = safewrite(fd, buf, bytes); # 1411| if (r < 0) # 1412|-> return -1; # 1413| # 1414| /* safewrite() guarantees all data will be written */ Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfile.c: scope_hint: In function ‘virFileMakeParentPath’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfile.c:3237:14: warning[-Wanalyzer-null-argument]: use of NULL 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.4.0-build/libvirt-10.4.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:30: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfile.c:26: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfile.c:3235:11: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfile.c: scope_hint: In function ‘virFileMakeParentPath’ libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:28: included_from: Included from here. /usr/include/string.h:273:14: note: argument 1 of ‘strrchr’ must be non-null # 3235| tmp = g_strdup(path); # 3236| # 3237|-> if ((p = strrchr(tmp, '/')) == NULL) { # 3238| errno = EINVAL; # 3239| return -1; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfile.c:3324:21: warning[unix.Malloc]: Potential leak of memory pointed to by 'name' # 3322| } # 3323| if (rc != 0) { # 3324|-> errno = rc; # 3325| goto cleanup; # 3326| } Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfile.c: scope_hint: In function ‘virFileSanitizePath’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfile.c:3364:16: warning[-Wanalyzer-null-argument]: use of NULL ‘path’ where non-null expected libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfile.c:3360:17: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfile.c: scope_hint: In function ‘virFileSanitizePath’ <built-in>: note: argument 1 of ‘__builtin_strstr’ must be non-null # 3362| /* don't sanitize URIs - rfc3986 states that two slashes may lead to a # 3363| * different resource, thus removing them would possibly change the path */ # 3364|-> if ((uri = strstr(path, "://")) && strchr(path, '/') > uri) # 3365| return cleanpath; # 3366| Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfile.c: scope_hint: In function ‘virFileIsSharedFSType’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfile.c:3580:18: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfile.c:3578:15: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfile.c: scope_hint: In function ‘virFileIsSharedFSType’ /usr/include/features.h:511: included_from: Included from here. /usr/include/errno.h:25: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:23: included_from: Included from here. /usr/include/sys/statfs.h:35:12: note: argument 1 of ‘statfs’ must be non-null # 3578| dirpath = g_strdup(path); # 3579| # 3580|-> statfs_ret = statfs(dirpath, &sb); # 3581| # 3582| while ((statfs_ret < 0) && (p != dirpath)) { Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfile.c: scope_hint: In function ‘virFileGetHugepageSize’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfile.c:3637:9: warning[-Wanalyzer-null-argument]: use of NULL ‘path’ where non-null expected libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:81:30: note: in definition of macro ‘STRNEQ’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfile.c:3723:24: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfile.c: scope_hint: In function ‘virFileGetHugepageSize’ /usr/include/sys/statfs.h:35:12: note: argument 1 of ‘statfs’ must be non-null # 3635| struct statfs fs; # 3636| # 3637|-> if (statfs(path, &fs) < 0) { # 3638| virReportSystemError(errno, # 3639| _("cannot determine filesystem for '%1$s'"), Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c: scope_hint: In function ‘virFirewallCmdToString’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c:546:26: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘fwCmd’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c:30: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virlog.h:88:5: note: in expansion of macro ‘VIR_DEBUG_INT’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c:905:5: note: in expansion of macro ‘VIR_DEBUG’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.h:23: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c:25: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:79:29: note: in definition of macro ‘STREQ’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c:685:13: note: in expansion of macro ‘VIR_NFTABLES_ARG_IS_CREATE’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c:242:5: note: in expansion of macro ‘VIR_FIREWALL_RETURN_NULL_IF_ERROR’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c:242:5: note: in expansion of macro ‘VIR_FIREWALL_RETURN_NULL_IF_ERROR’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c:443:5: note: in expansion of macro ‘VIR_FIREWALL_CMD_RETURN_IF_ERROR’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c:443:5: note: in expansion of macro ‘VIR_FIREWALL_CMD_RETURN_IF_ERROR’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c:443:5: note: in expansion of macro ‘VIR_FIREWALL_CMD_RETURN_IF_ERROR’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c:443:5: note: in expansion of macro ‘VIR_FIREWALL_CMD_RETURN_IF_ERROR’ # 544| # 545| virBufferAdd(&buf, cmd, -1); # 546|-> for (i = 0; i < fwCmd->argsLen; i++) { # 547| virBufferAddLit(&buf, " "); # 548| virBufferAdd(&buf, fwCmd->args[i], -1); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c:995:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'firewall' # 993| # 994| if (firewall->ngroups == 0) # 995|-> VIR_DEBUG("original firewall object is empty"); # 996| else # 997| *fwRemoval = g_steal_pointer(&firewall); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfirewall.c:1077:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'newfw' # 1075| ngroups = virXPathNodeSet("./group", ctxt, &groupNodes); # 1076| if (ngroups < 0) # 1077|-> return -1; # 1078| # 1079| for (g = 0; g < ngroups; g++) { Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virhostcpu.c:1350:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'msr' # 1348| # 1349| if ((fd = open(KVM_DEVICE, O_RDONLY)) < 0) { # 1350|-> virReportSystemError(errno, _("Unable to open %1$s"), KVM_DEVICE); # 1351| return -1; # 1352| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virhostcpu.c:1500:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'kvm_cpuid' # 1498| # 1499| /* enlarge the buffer and try again */ # 1500|-> if (errno == E2BIG) { # 1501| VIR_DEBUG("looping %zu", alloc_size); # 1502| continue; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virhostcpu.c:1530:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'info' # 1528| # 1529| if ((kvmFd = open(KVM_DEVICE, O_RDONLY)) < 0) { # 1530|-> virReportSystemError(errno, _("Unable to open %1$s"), KVM_DEVICE); # 1531| return NULL; # 1532| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virhostcpu.c:1614:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'line' # 1612| # 1613| if (!ARCH_IS_X86(arch) && !ARCH_IS_PPC64(arch) && !ARCH_IS_S390(arch)) # 1614|-> return 0; # 1615| # 1616| while (fgets(line, lineLen, cpuinfo)) { Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virhostmem.c: scope_hint: In function ‘virHostMemGetStats’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virhostmem.c:286:19: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(meminfo_path, "r")’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virhostmem.h:24: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virhostmem.c:39: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virhostmem.c:253:5: note: in expansion of macro ‘virCheckFlags’ # 284| SYSFS_SYSTEM_PATH "/node/node%d/meminfo", cellNum); # 285| } # 286|-> meminfo = fopen(meminfo_path, "r"); # 287| # 288| if (!meminfo) { Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virhostmem.c:286:19: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(meminfo_path, "r")’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virhostmem.c:253:5: note: in expansion of macro ‘virCheckFlags’ # 284| SYSFS_SYSTEM_PATH "/node/node%d/meminfo", cellNum); # 285| } # 286|-> meminfo = fopen(meminfo_path, "r"); # 287| # 288| if (!meminfo) { Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virjson.c:170:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'newobj' # 168| # 169| if (strlen(key) < 3 || key[1] != ':') { # 170|-> virReportError(VIR_ERR_INTERNAL_ERROR, # 171| _("argument key '%1$s' is too short or malformed"), # 172| key); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virjson.c:321:21: warning[unix.Malloc]: Potential leak of memory pointed to by 'jsonMap' # 319| # 320| if (!map) { # 321|-> if (type == 'M') # 322| continue; # 323| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virjson.c:599:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'jvalue' # 597| g_autoptr(virJSONValue) jvalue = virJSONValueNewString(g_strdup(value)); # 598| # 599|-> return virJSONValueObjectInsert(object, key, &jvalue, prepend); # 600| } # 601| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virjson.c:629:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'jvalue' # 627| # 628| if (virJSONValueObjectAppend(object, key, &jvalue) < 0) # 629|-> return -1; # 630| # 631| return 0; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virjson.c:643:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'jvalue' # 641| # 642| if (virJSONValueObjectAppend(object, key, &jvalue) < 0) # 643|-> return -1; # 644| # 645| return 0; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virjson.c:657:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'jvalue' # 655| # 656| if (virJSONValueObjectAppend(object, key, &jvalue) < 0) # 657|-> return -1; # 658| # 659| return 0; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virjson.c:671:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'jvalue' # 669| # 670| if (virJSONValueObjectAppend(object, key, &jvalue) < 0) # 671|-> return -1; # 672| # 673| return 0; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virjson.c:689:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'jvalue' # 687| # 688| if (virJSONValueObjectAppend(object, key, &jvalue) < 0) # 689|-> return -1; # 690| # 691| return 0; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virjson.c:703:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'jvalue' # 701| # 702| if (virJSONValueObjectAppend(object, key, &jvalue) < 0) # 703|-> return -1; # 704| # 705| return 0; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virjson.c:716:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'jvalue' # 714| # 715| if (virJSONValueObjectAppend(object, key, &jvalue) < 0) # 716|-> return -1; # 717| # 718| return 0; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virjson.c:747:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'jvalue' # 745| # 746| if (virJSONValueArrayAppend(object, &jvalue) < 0) # 747|-> return -1; # 748| # 749| return 0; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virjson.c:1299:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'ret' # 1297| if (!child || # 1298| !(ret[i] = g_strdup(virJSONValueGetString(child)))) { # 1299|-> virReportError(VIR_ERR_INTERNAL_ERROR, "%s", # 1300| _("JSON string array contains non-string element")); # 1301| return NULL; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virjson.c:1454:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'value' # 1452| # 1453| if (virJSONParserInsertValue(parser, &value) < 0) # 1454|-> return 0; # 1455| # 1456| return 1; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virjson.c:1470:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'value' # 1468| # 1469| if (virJSONParserInsertValue(parser, &value) < 0) # 1470|-> return 0; # 1471| # 1472| return 1; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virjson.c:1487:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'value' # 1485| # 1486| if (virJSONParserInsertValue(parser, &value) < 0) # 1487|-> return 0; # 1488| # 1489| return 1; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virjson.c:1504:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'value' # 1502| # 1503| if (virJSONParserInsertValue(parser, &value) < 0) # 1504|-> return 0; # 1505| # 1506| return 1; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virjson.c:1541:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'tmp' # 1539| # 1540| if (virJSONParserInsertValue(parser, &value) < 0) # 1541|-> return 0; # 1542| # 1543| VIR_REALLOC_N(parser->state, parser->nstate + 1); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virjson.c:1586:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'tmp' # 1584| # 1585| if (virJSONParserInsertValue(parser, &value) < 0) # 1586|-> return 0; # 1587| # 1588| VIR_REALLOC_N(parser->state, parser->nstate + 1); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virjson.c:1916:21: warning[unix.Malloc]: Potential leak of memory pointed to by 'existobj' # 1914| # 1915| if (virJSONValueObjectAppend(retobj, tokens[0], &newobj) < 0) # 1916|-> return -1; # 1917| # 1918| } else { Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virjson.c:1938:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'deflattened' # 1936| virJSONValueObjectDeflattenWorker, # 1937| deflattened) < 0) # 1938|-> return NULL; # 1939| # 1940| return g_steal_pointer(&deflattened); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virjson.c:1973:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'arraymembers' # 1971| # 1972| if (virStrToLong_uip(pair->key, NULL, 10, &keynum) < 0) # 1973|-> return; # 1974| # 1975| if (keynum >= obj->npairs) Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virlockspace.c: scope_hint: In function ‘virLockSpaceResourceFree’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virlockspace.c:94:17: warning[-Wanalyzer-null-argument]: use of NULL 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.4.0-build/libvirt-10.4.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:30: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virlockspace.h:24: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virlockspace.c:24: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virlockspace.c:124:17: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virlockspace.c: scope_hint: In function ‘virLockSpaceResourceFree’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virlockspace.c:69:15: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virlockspace.c: scope_hint: In function ‘virLockSpaceResourceFree’ /usr/include/bits/sigstksz.h:24: included_from: Included from here. /usr/include/signal.h:328: included_from: Included from here. /usr/include/glib-2.0/glib/gbacktrace.h:38: included_from: Included from here. /usr/include/glib-2.0/glib.h:36: included_from: Included from here. /usr/include/unistd.h:858:12: note: argument 1 of ‘unlink’ must be non-null # 92| } # 93| } else { # 94|-> if (unlink(res->path) < 0 && # 95| errno != ENOENT) { # 96| VIR_WARN("Failed to unlink resource %s: %s", Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virlockspace.c:423:11: warning[deadcode.DeadStores]: Although the value stored to 'pairs' is used in the enclosing expression, the value is never actually read from 'pairs' # 421| # 422| # 423|-> tmp = pairs = virHashGetItems(lockspace->resources, NULL, false); # 424| while (tmp && tmp->value) { # 425| virLockSpaceResource *res = (virLockSpaceResource *)tmp->value; Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virmdev.c: scope_hint: In function ‘virMediatedDeviceIsUsed’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virmdev.c:400:51: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘dev’ # 398| virMediatedDevice *tmp = NULL; # 399| # 400|-> if ((tmp = virMediatedDeviceListFind(list, dev->path))) { # 401| virMediatedDeviceGetUsedBy(tmp, &drvname, &domname); # 402| virReportError(VIR_ERR_OPERATION_INVALID, Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virnetdev.c:2813:21: warning[unix.Malloc]: Potential leak of memory pointed to by 'entry' # 2811| next++; # 2812| if (virNetDevParseMcast(cur, entry)) # 2813|-> return -1; # 2814| # 2815| /* Only return global multicast MAC addresses for Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virnetdevmacvlan.c:420:13: warning[core.uninitialized.Branch]: Branch condition evaluates to a garbage value # 418| } # 419| # 420|-> if (tb_vfinfo[IFLA_VF_MAC]) { # 421| struct ifla_vf_mac *mac = RTA_DATA(tb_vfinfo[IFLA_VF_MAC]); # 422| unsigned char *m = mac->mac; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virnetdevopenvswitch.c:555:11: warning[deadcode.DeadStores]: Although the value stored to 'absoluteOvsVsctlPath' is used in the enclosing expression, the value is never actually read from 'absoluteOvsVsctlPath' # 553| int status; # 554| # 555|-> if (!(absoluteOvsVsctlPath = virFindFileInPath(OVS_VSCTL))) { # 556| /* If there is no 'ovs-vsctl' then the interface is # 557| * probably not an OpenVSwitch interface and the @path to Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virnetdevvportprofile.c:867:25: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 865| *nth = 0; # 866| # 867|-> if (ifindex <= 0 && virNetDevGetIndex(ifname, &ifindex) < 0) # 868| return -1; # 869| Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virobject.c: scope_hint: In function ‘virClassIsDerivedFrom’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virobject.c:226:35: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘parent’ # 224| { # 225| while (klass) { # 226|-> if (klass->magic == parent->magic) # 227| return true; # 228| klass = klass->parent; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virpci.c:1379:20: warning[unix.Malloc]: Potential leak of memory pointed to by 'ret' # 1377| # 1378| if (strncmp(field, fieldnames[i], len)) # 1379|-> return NULL; # 1380| # 1381| field += len; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virpci.c:1881:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'dev' # 1879| # 1880| if (!virFileExists(dev->path)) { # 1881|-> virReportSystemError(errno, # 1882| _("Device %1$s not found: could not access %2$s"), # 1883| dev->name, dev->path); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virpci.c:2720:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'bdf' # 2718| # 2719| if (virPCIDeviceAddressParse(config_address, bdf) < 0) { # 2720|-> virReportError(VIR_ERR_INTERNAL_ERROR, # 2721| _("Failed to parse PCI config address '%1$s'"), # 2722| config_address); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virpci.c:2790:21: warning[unix.Malloc]: Potential leak of memory pointed to by 'list' # 2788| # 2789| if (virFileReadAll(totalvfs_file, 16, &totalvfs_str) < 0) # 2790|-> return -1; # 2791| if (virStrToLong_ull(totalvfs_str, &end, 10, &maxfunctions) < 0) { # 2792| virReportError(VIR_ERR_INTERNAL_ERROR, Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virpci.c:2963:17: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 2961| g_autofree char *thisPhysPortID = NULL; # 2962| # 2963|-> if (virNetDevGetPhysPortID(entry->d_name, &thisPhysPortID) < 0) # 2964| return -1; # 2965| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virpci.c:2984:17: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 2982| g_autofree char *thisPhysPortName = NULL; # 2983| # 2984|-> if (virNetDevGetPhysPortName(entry->d_name, &thisPhysPortName) < 0) # 2985| return -1; # 2986| Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virpcivpd.c: scope_hint: In function ‘virPCIVPDResourceIsValidTextValue’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virpcivpd.c:181:21: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘v’ /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.4.0-build/libvirt-10.4.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:30: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virthread.h:24: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virpcivpd.c:29: included_from: Included from here. /usr/include/glib-2.0/glib/gstrfuncs.h:324:38: note: in definition of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virpcivpd.c:578:25: note: in expansion of macro ‘g_strstrip’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virpcivpd.c:578:16: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virpcivpd.c: scope_hint: In function ‘virPCIVPDResourceIsValidTextValue’ # 179| bool ret = true; # 180| # 181|-> for (v = value; *v; v++) { # 182| if (!g_ascii_isprint(*v)) { # 183| ret = false; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virpcivpd.c:542:10: warning[unix.Malloc]: Potential leak of memory pointed to by 'buf' # 540| /* May have exited the loop prematurely in case RV or RW were encountered and # 541| * they were not the last fields in the section. */ # 542|-> if ((fieldPos < resPos + resDataLen)) { # 543| /* unparsed data still present */ # 544| VIR_DEBUG("parsing ended prematurely"); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virpcivpd.c:618:20: warning[unix.Malloc]: Potential leak of memory pointed to by 'res' # 616| /* Read the resource data type tag. */ # 617| if (virPCIVPDReadVPDBytes(vpdFileFd, &tag, 1, resPos, &csum) < 0) # 618|-> return NULL; # 619| # 620| /* 0x80 == 0b10000000 - the large resource data type flag. */ Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virqemu.c:161:15: warning[deadcode.DeadStores]: Although the value stored to 'tmpkey' is used in the enclosing expression, the value is never actually read from 'tmpkey' # 159| # 160| if (data->prefix) # 161|-> key = tmpkey = g_strdup_printf("%s.%s", data->prefix, key); # 162| # 163| return virQEMUBuildCommandLineJSONRecurse(key, value, data->buf, NULL, Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virrandom.c:178:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'token' # 176| # 177| if (virRandomBytes(data, len) < 0) # 178|-> return NULL; # 179| # 180| for (i = 0; i < len; i++) { Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virresctrl.c:523:13: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 521| struct dirent *ent = NULL; # 522| # 523|-> while ((rv = virDirRead(dirp, &ent, SYSFS_RESCTRL_PATH "/info")) > 0) { # 524| g_autofree char *cbm_mask_str = NULL; # 525| g_autoptr(virBitmap) cbm_mask_map = NULL; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virresctrl.c:760:10: warning[deadcode.DeadStores]: Although the value stored to 'ret' is used in the enclosing expression, the value is never actually read from 'ret' # 758| return ret; # 759| # 760|-> if ((ret = virResctrlGetMemoryBandwidthInfo(resctrl)) < 0) # 761| return -1; # 762| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virresctrl.c:763:10: warning[deadcode.DeadStores]: Although the value stored to 'ret' is used in the enclosing expression, the value is never actually read from 'ret' # 761| return -1; # 762| # 763|-> if ((ret = virResctrlGetCacheInfo(resctrl, dirp)) < 0) # 764| return -1; # 765| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virresctrl.c:766:10: warning[deadcode.DeadStores]: Although the value stored to 'ret' is used in the enclosing expression, the value is never actually read from 'ret' # 764| return -1; # 765| # 766|-> if ((ret = virResctrlGetMonitorInfo(resctrl)) < 0) # 767| return -1; # 768| Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virrotatingfile.c: scope_hint: In function ‘virRotatingFileWriterDelete’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virrotatingfile.c:183:9: warning[-Wanalyzer-null-argument]: use of NULL 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.4.0-build/libvirt-10.4.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:30: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virrotatingfile.h:24: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virrotatingfile.c:28: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virrotatingfile.c:239:22: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virrotatingfile.c: scope_hint: In function ‘virRotatingFileWriterDelete’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virrotatingfile.c:26: included_from: Included from here. /usr/include/unistd.h:858:12: note: argument 1 of ‘unlink’ must be non-null # 181| size_t i; # 182| # 183|-> if (unlink(file->basepath) < 0 && # 184| errno != ENOENT) { # 185| virReportSystemError(errno, Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virsocketaddr.c:486:33: warning[core.UndefinedBinaryOperatorResult]: The left operand of '==' is a garbage value # 484| /* Short-circuit since getnameinfo doesn't work # 485| * nicely for UNIX sockets */ # 486|-> if (addr->data.sa.sa_family == AF_UNIX) { # 487| if (withService) { # 488| addrstr = g_strdup_printf(VIR_LOOPBACK_IPV4_ADDR "%s0", Error: GCC_ANALYZER_WARNING (CWE-457): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virsocketaddr.c: scope_hint: In function ‘virSocketAddrGetRange’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virsocketaddr.c:1023:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘t2[7]’ /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.4.0-build/libvirt-10.4.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:30: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virsocket.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virsocketaddr.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virsocketaddr.c:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virsocketaddr.c:491:23: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virsocketaddr.c: scope_hint: In function ‘virSocketAddrGetRange’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virsocketaddr.c:491:23: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virsocketaddr.c: scope_hint: In function ‘virSocketAddrGetRange’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virsocketaddr.c:898:9: note: in expansion of macro ‘VIR_SOCKET_ADDR_FAMILY’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virsocketaddr.c:971:9: note: in expansion of macro ‘VIR_SOCKET_ADDR_IS_FAMILY’ # 1021| } # 1022| } # 1023|-> ret = t2[7] - t1[7]; # 1024| if (ret < 0) { # 1025| virReportError(VIR_ERR_INTERNAL_ERROR, Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virsocketaddr.c:1290:16: warning[core.UndefinedBinaryOperatorResult]: The left operand of '==' is a garbage value # 1288| sizeof(res.data.inet4.sin_addr.s_addr)) == 0; # 1289| case AF_INET6: # 1290|-> return IN6_IS_ADDR_LOOPBACK(&res.data.inet6.sin6_addr); # 1291| } # 1292| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virsysinfo.c:321:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'ret' # 319| # 320| if (virFileReadAll(CPUINFO, CPUINFO_FILE_LEN, &outbuf) < 0) { # 321|-> virReportError(VIR_ERR_INTERNAL_ERROR, # 322| _("Failed to open %1$s"), CPUINFO); # 323| return NULL; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virsysinfo.c:602:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'ret' # 600| /* Gather info from /proc/cpuinfo */ # 601| if (virFileReadAll(CPUINFO, CPUINFO_FILE_LEN, &outbuf) < 0) { # 602|-> virReportError(VIR_ERR_INTERNAL_ERROR, # 603| _("Failed to open %1$s"), CPUINFO); # 604| return NULL; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virsysinfo.c:1216:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'ret' # 1214| # 1215| if (virSysinfoParseOEMStrings(outbuf, &ret->oemStrings) < 0) # 1216|-> return NULL; # 1217| # 1218| ret->nprocessor = 0; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virsystemd.c:900:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'act' # 898| fdnames = getenv("LISTEN_FDNAMES"); # 899| if (!fdnames) { # 900|-> virReportError(VIR_ERR_INTERNAL_ERROR, "%s", # 901| _("Missing LISTEN_FDNAMES env from systemd socket activation")); # 902| return NULL; Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_logger.c:29: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virthread.h:214:38: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(g_strdup_printf("%s/%s.log", *logger.logDir, name), "a")’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virthread.h:232:5: note: in expansion of macro ‘VIR_WITH_MUTEX_LOCK_GUARD_’ libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_logger.c:198:5: note: in expansion of macro ‘VIR_WITH_MUTEX_LOCK_GUARD’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virthread.h:232:5: note: in expansion of macro ‘VIR_WITH_MUTEX_LOCK_GUARD_’ libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_logger.c:198:5: note: in expansion of macro ‘VIR_WITH_MUTEX_LOCK_GUARD’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virthread.h:232:5: note: in expansion of macro ‘VIR_WITH_MUTEX_LOCK_GUARD_’ libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_logger.c:198:5: note: in expansion of macro ‘VIR_WITH_MUTEX_LOCK_GUARD’ # 212| # 213| #define VIR_WITH_MUTEX_LOCK_GUARD_(m, name) \ # 214|-> for (g_auto(virLockGuard) name = virLockGuardLock(m); name.mutex; \ # 215| name.mutex = (virLockGuardUnlock(&name), NULL)) # 216| /** Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virthread.h:214:38: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(g_strdup_printf("%s/%s.log", *logger.logDir, name), "a")’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virthread.h:232:5: note: in expansion of macro ‘VIR_WITH_MUTEX_LOCK_GUARD_’ libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_logger.c:198:5: note: in expansion of macro ‘VIR_WITH_MUTEX_LOCK_GUARD’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virthread.h:232:5: note: in expansion of macro ‘VIR_WITH_MUTEX_LOCK_GUARD_’ libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_logger.c:198:5: note: in expansion of macro ‘VIR_WITH_MUTEX_LOCK_GUARD’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virthread.h:232:5: note: in expansion of macro ‘VIR_WITH_MUTEX_LOCK_GUARD_’ libvirt-10.4.0-build/libvirt-10.4.0/src/libxl/libxl_logger.c:198:5: note: in expansion of macro ‘VIR_WITH_MUTEX_LOCK_GUARD’ # 212| # 213| #define VIR_WITH_MUTEX_LOCK_GUARD_(m, name) \ # 214|-> for (g_auto(virLockGuard) name = virLockGuardLock(m); name.mutex; \ # 215| name.mutex = (virLockGuardUnlock(&name), NULL)) # 216| /** Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/src/util/virutil.c: scope_hint: In function ‘virParseOwnershipIds’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virutil.c:1383:11: warning[-Wanalyzer-null-argument]: use of NULL 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.4.0-build/libvirt-10.4.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:30: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virerror.h:24: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virutil.c:49: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/virutil.c:1380:17: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.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: libvirt-10.4.0-build/libvirt-10.4.0/src/util/virxml.c:1597:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'validator' # 1595| if (!(validator->rngParser = # 1596| xmlRelaxNGNewParserCtxt(validator->schemafile))) { # 1597|-> virReportError(VIR_ERR_INTERNAL_ERROR, # 1598| _("Unable to create RelaxNG parser for schema '%1$s'"), # 1599| validator->schemafile); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/vbox/vbox_network.c:920:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'def' # 918| # 919| cleanup: # 920|-> vboxIIDUnalloc(&vboxnet0IID); # 921| VBOX_UTF16_FREE(networkNameUtf16); # 922| VBOX_RELEASE(networkInterface); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/vbox/vbox_snapshot_conf.c:147:5: warning[deadcode.DeadStores]: Value stored to 'n' is never read # 145| } # 146| } # 147|-> n = 0; # 148| VIR_FREE(nodes); # 149| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/src/vbox/vbox_snapshot_conf.c:1199:11: warning[deadcode.DeadStores]: Although the value stored to 'xml' is used in the enclosing expression, the value is never actually read from 'xml' # 1197| } # 1198| # 1199|-> if (!(xml = virXMLParse(filePath, NULL, NULL, NULL, &xPathContext, NULL, false))) # 1200| return -1; # 1201| Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/src/vmware/vmware_conf.c: scope_hint: In function ‘vmwareExtractPid’ libvirt-10.4.0-build/libvirt-10.4.0/src/vmware/vmware_conf.c:444:20: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(g_strdup_printf("%s/vmware.log", g_path_get_dirname(vmxPath)), "r")’ # 442| logFilePath = g_strdup_printf("%s/vmware.log", vmxDir); # 443| # 444|-> if ((logFile = fopen(logFilePath, "r")) == NULL) # 445| goto cleanup; # 446| Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.4.0-build/libvirt-10.4.0/src/vmware/vmware_conf.c:444:20: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(g_strdup_printf("%s/vmware.log", g_path_get_dirname(vmxPath)), "r")’ # 442| logFilePath = g_strdup_printf("%s/vmware.log", vmxDir); # 443| # 444|-> if ((logFile = fopen(logFilePath, "r")) == NULL) # 445| goto cleanup; # 446| Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.4.0-build/libvirt-10.4.0/tests/commandhelper.c: scope_hint: In function ‘main’ libvirt-10.4.0-build/libvirt-10.4.0/tests/commandhelper.c:55:1: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’ # 53| # 54| free(args); # 55|-> } # 56| # 57| static void cleanupStringList(char ***ptr) Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/tests/commandhelper.c:73:5: warning[-Wanalyzer-null-argument]: use of NULL ‘fopen("/builddir/build/BUILD/libvirt-10.4.0-build/libvirt-10.4.0/redhat-linux-build/tests/commandhelper.log", "w")’ where non-null expected libvirt-10.4.0-build/libvirt-10.4.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-688): libvirt-10.4.0-build/libvirt-10.4.0/tests/commandhelper.c:73:5: warning[-Wanalyzer-null-argument]: use of NULL ‘log’ where non-null expected libvirt-10.4.0-build/libvirt-10.4.0/tests/commandhelper.c: scope_hint: In function ‘main’ libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:27: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/viralloc.h:25: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/tests/testutils.h:23: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/tests/commandhelper.c:30: included_from: Included from here. /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: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/commandhelper.c:92:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'args' # 90| # 91| if (!(args->readfds = calloc(1, sizeof(*args->readfds)))) # 92|-> return NULL; # 93| # 94| args->numreadfds = 1; Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.4.0-build/libvirt-10.4.0/tests/commandhelper.c:97:19: warning[-Wanalyzer-malloc-leak]: leak of ‘parseArguments(argc, argv)’ # 95| args->readfds[0] = STDIN_FILENO; # 96| # 97|-> for (i = 1; i < argc; i++) { # 98| if (STREQ(argv[i - 1], "--readfd")) { # 99| char c; Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.4.0-build/libvirt-10.4.0/tests/commandhelper.c: scope_hint: In function ‘parseArguments’ libvirt-10.4.0-build/libvirt-10.4.0/tests/commandhelper.c:101:27: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’ libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:79:29: note: in definition of macro ‘STREQ’ # 99| char c; # 100| # 101|-> args->readfds = realloc(args->readfds, # 102| (args->numreadfds + 1) * # 103| sizeof(*args->readfds)); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/commandhelper.c:260:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'fds' # 258| /* plus one NULL terminator */ # 259| if (!(buffers = calloc(args->numreadfds + 1, sizeof(*buffers)))) # 260|-> return -1; # 261| # 262| if (!(buflen = calloc(args->numreadfds, sizeof(*buflen)))) Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/commandhelper.c:263:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'buffers' # 261| # 262| if (!(buflen = calloc(args->numreadfds, sizeof(*buflen)))) # 263|-> return -1; # 264| # 265| if (args->close_stdin) { Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/commandhelper.c:267:21: warning[unix.Malloc]: Potential leak of memory pointed to by 'buflen' # 265| if (args->close_stdin) { # 266| if (freopen("/dev/null", "r", stdin) != stdin) # 267|-> return -1; # 268| usleep(100 * 1000); # 269| } Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/tests/commandhelper.c: scope_hint: In function ‘main’ libvirt-10.4.0-build/libvirt-10.4.0/tests/commandhelper.c:350:17: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen("/builddir/build/BUILD/libvirt-10.4.0-build/libvirt-10.4.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): libvirt-10.4.0-build/libvirt-10.4.0/tests/commandhelper.c:350:17: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen("/builddir/build/BUILD/libvirt-10.4.0-build/libvirt-10.4.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: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/commandtest.c:596:9: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'outbuf') # 594| } # 595| # 596|-> if (*outbuf) { # 597| puts("output buffer is not an allocated empty string"); # 598| goto cleanup; Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/tests/commandtest.c: scope_hint: In function ‘mymain’ libvirt-10.4.0-build/libvirt-10.4.0/tests/commandtest.c:1261:48: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(__open_alias("/dev/null", 0), 3)’ # 1259| * want by overwriting any externally inherited fds, then # 1260| * initialize, then clear the slots for testing. */ # 1261|-> if ((fd = open("/dev/null", O_RDONLY)) < 0 || # 1262| dup2(fd, 3) < 0 || # 1263| dup2(fd, 4) < 0 || Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/tests/commandtest.c:1262:25: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(fd, 4)’ # 1260| * initialize, then clear the slots for testing. */ # 1261| if ((fd = open("/dev/null", O_RDONLY)) < 0 || # 1262|-> dup2(fd, 3) < 0 || # 1263| dup2(fd, 4) < 0 || # 1264| dup2(fd, 5) < 0 || Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/tests/commandtest.c:1263:25: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(fd, 5)’ # 1261| if ((fd = open("/dev/null", O_RDONLY)) < 0 || # 1262| dup2(fd, 3) < 0 || # 1263|-> dup2(fd, 4) < 0 || # 1264| dup2(fd, 5) < 0 || # 1265| dup2(fd, 6) < 0 || Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/tests/commandtest.c:1264:25: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(fd, 6)’ # 1262| dup2(fd, 3) < 0 || # 1263| dup2(fd, 4) < 0 || # 1264|-> dup2(fd, 5) < 0 || # 1265| dup2(fd, 6) < 0 || # 1266| dup2(fd, 7) < 0 || Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/tests/commandtest.c:1265:25: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(fd, 7)’ # 1263| dup2(fd, 4) < 0 || # 1264| dup2(fd, 5) < 0 || # 1265|-> dup2(fd, 6) < 0 || # 1266| dup2(fd, 7) < 0 || # 1267| dup2(fd, 8) < 0 || Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/tests/commandtest.c:1266:25: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(fd, 8)’ # 1264| dup2(fd, 5) < 0 || # 1265| dup2(fd, 6) < 0 || # 1266|-> dup2(fd, 7) < 0 || # 1267| dup2(fd, 8) < 0 || # 1268| (fd > 8 && VIR_CLOSE(fd) < 0)) { Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/cputest.c:81:11: warning[deadcode.DeadStores]: Although the value stored to 'doc' is used in the enclosing expression, the value is never actually read from 'doc' # 79| virArchToString(arch), name); # 80| # 81|-> if (!(doc = virXMLParseFileCtxt(xml, &ctxt))) # 82| return NULL; # 83| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/cputest.c:106:11: warning[deadcode.DeadStores]: Although the value stored to 'doc' is used in the enclosing expression, the value is never actually read from 'doc' # 104| virArchToString(arch), name); # 105| # 106|-> if (!(doc = virXMLParseFileCtxt(xml, &ctxt))) # 107| return NULL; # 108| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/fchosttest.c:213:10: warning[deadcode.DeadStores]: Although the value stored to 'fabric_wwn' is used in the enclosing expression, the value is never actually read from 'fabric_wwn' # 211| return -1; # 212| # 213|-> if ((fabric_wwn = virVHBAGetConfig(TEST_FC_HOST_PREFIX, # 214| TEST_FC_HOST_NUM_NO_FAB, # 215| "fabric_name"))) Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/metadatatest.c:68:11: warning[deadcode.DeadStores]: Although the value stored to 'doc' is used in the enclosing expression, the value is never actually read from 'doc' # 66| return NULL; # 67| # 68|-> if (!(doc = virXMLParseStringCtxt(xml, "(domain_definition)", &ctxt))) # 69| return NULL; # 70| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/networkmetadatatest.c:68:11: warning[deadcode.DeadStores]: Although the value stored to 'doc' is used in the enclosing expression, the value is never actually read from 'doc' # 66| return NULL; # 67| # 68|-> if (!(doc = virXMLParseStringCtxt(xml, "(network_definition)", &ctxt))) # 69| return NULL; # 70| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/networkxml2firewalltest.c:112:14: warning[deadcode.DeadStores]: Although the value stored to 'actualargv' is used in the enclosing expression, the value is never actually read from 'actualargv' # 110| return -1; # 111| # 112|-> actual = actualargv = virBufferContentAndReset(&buf); # 113| # 114| /* The first network to be created populates the Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/qemublocktest.c:68:11: warning[deadcode.DeadStores]: Although the value stored to 'xml' is used in the enclosing expression, the value is never actually read from 'xml' # 66| xmlsrc->type = data->type; # 67| # 68|-> if (!(xml = virXMLParseStringCtxt(data->xml, "(test storage source XML)", &ctxt))) # 69| return -1; # 70| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/qemucaps2xmltest.c:60:11: warning[deadcode.DeadStores]: Although the value stored to 'xml' is used in the enclosing expression, the value is never actually read from 'xml' # 58| g_autofree xmlNodePtr *nodes = NULL; # 59| # 60|-> if (!(xml = virXMLParseStringCtxt(caps, "(test caps)", &ctxt))) # 61| return NULL; # 62| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/qemudomaincheckpointxml2xmltest.c:92:9: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 90| return -1; # 91| # 92|-> if (STRNEQ(outXmlData, actual)) { # 93| virTestDifferenceFull(stderr, outXmlData, outxml, actual, inxml); # 94| return -1; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/qemumigparamstest.c:73:11: warning[deadcode.DeadStores]: Although the value stored to 'doc' is used in the enclosing expression, the value is never actually read from 'doc' # 71| data->name); # 72| # 73|-> if (!(doc = virXMLParseFileCtxt(xmlFile, &ctxt))) # 74| return -1; # 75| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/qemumonitorjsontest.c:415:5: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 413| for (i = 0; i < ninfo; i++) # 414| qemuMonitorMachineInfoFree(info[i]); # 415|-> VIR_FREE(info); # 416| # 417| return ret; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/qemumonitorjsontest.c:878:5: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 876| for (i = 0; i < npaths; i++) # 877| qemuMonitorJSONListPathFree(paths[i]); # 878|-> VIR_FREE(paths); # 879| return ret; # 880| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/qemumonitorjsontest.c:2217:5: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 2215| for (i = 0; i < ninfo; i++) # 2216| VIR_FREE(info[i]); # 2217|-> VIR_FREE(info); # 2218| # 2219| return ret; Error: GCC_ANALYZER_WARNING (CWE-404): libvirt-10.4.0-build/libvirt-10.4.0/tests/qemunbdkittest.c: scope_hint: In function ‘testInfoSetArgs’ libvirt-10.4.0-build/libvirt-10.4.0/tests/qemunbdkittest.c:168:1: warning[-Wanalyzer-va-list-leak]: missing call to ‘va_end’ # 166| } # 167| } # 168|-> } # 169| # 170| Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/tests/securityselinuxlabeltest.c: scope_hint: In function ‘testSELinuxLoadFileList’ libvirt-10.4.0-build/libvirt-10.4.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.4.0-build/libvirt-10.4.0/tests", testname), "r")’ # 105| testname); # 106| # 107|-> if (!(fp = fopen(path, "r"))) # 108| return -1; # 109| Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.4.0-build/libvirt-10.4.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.4.0-build/libvirt-10.4.0/tests", testname), "r")’ # 105| testname); # 106| # 107|-> if (!(fp = fopen(path, "r"))) # 108| return -1; # 109| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/securityselinuxlabeltest.c:145:12: warning[unix.Malloc]: Potential leak of memory pointed to by 'line' # 143| } # 144| # 145|-> return 0; # 146| } # 147| Error: GCC_ANALYZER_WARNING (CWE-127): libvirt-10.4.0-build/libvirt-10.4.0/tests/testutils.c: scope_hint: In function ‘virTestDifferenceFullInternal’ libvirt-10.4.0-build/libvirt-10.4.0/tests/testutils.c:413:30: warning[-Wanalyzer-out-of-bounds]: buffer under-read /usr/lib64/glib-2.0/include/glibconfig.h:9: included_from: Included from here. /usr/include/glib-2.0/glib/gtypes.h:34: included_from: Included from here. /usr/include/glib-2.0/glib/galloca.h:34: included_from: Included from here. /usr/include/glib-2.0/glib.h:32: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:30: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/util/viralloc.h:25: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/tests/testutils.h:23: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/tests/testutils.c:29: included_from: Included from here. /usr/include/glib-2.0/glib/gmacros.h:1358:7: note: in expansion of macro ‘_GLIB_AUTOPTR_CLEAR_FUNC_NAME’ /usr/include/glib-2.0/glib/gmacros.h:1372:3: note: in expansion of macro ‘_GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfile.h:103:1: note: in expansion of macro ‘G_DEFINE_AUTOPTR_CLEANUP_FUNC’ /usr/include/glib-2.0/glib/gmacros.h:1372:3: note: in expansion of macro ‘_GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS’ libvirt-10.4.0-build/libvirt-10.4.0/src/util/virfile.h:103:1: note: in expansion of macro ‘G_DEFINE_AUTOPTR_CLEANUP_FUNC’ libvirt-10.4.0-build/libvirt-10.4.0/tests/testutils.c:413:30: note: valid subscripts for ‘""’ are ‘[0]’ to ‘[0]’ # └──────────────────────────────────┘ # ^ # 411| while (actualEnd > actualStart && # 412| expectEnd > expectStart && # 413|-> *actualEnd == *expectEnd) { # 414| actualEnd--; # 415| expectEnd--; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/testutils.c:843:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'preloads' # 841| # 842| if (!virFileIsExecutable(abs_lib_path)) { # 843|-> perror(abs_lib_path); # 844| va_end(ap); # 845| return EXIT_FAILURE; Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/tests/testutilsqemu.c: scope_hint: In function ‘testQemuInfoSetArgs’ libvirt-10.4.0-build/libvirt-10.4.0/tests/testutilsqemu.c:714:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup(fakefd)’ # 712| } # 713| # 714|-> if ((new->fds[i] = dup(fakefd)) < 0) { # 715| fprintf(stderr, "failed to duplicate fake fd: %s", # 716| g_strerror(errno)); Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/tests/testutilsqemu.c: scope_hint: In function ‘testQemuGetRealCapsInternal’ libvirt-10.4.0-build/libvirt-10.4.0/tests/testutilsqemu.c:798:14: warning[-Wanalyzer-null-argument]: use of NULL ‘capsfile’ 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.4.0-build/libvirt-10.4.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:30: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/conf/capabilities.h:24: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/tests/testutilsqemu.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/tests/testutilsqemu.c:4: included_from: Included from here. /usr/include/glib-2.0/glib/gstrfuncs.h:324:38: note: in definition of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/tests/testutilsqemu.c:777:20: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/tests/testutilsqemu.c: scope_hint: In function ‘testQemuGetRealCapsInternal’ libvirt-10.4.0-build/libvirt-10.4.0/tests/testutilsqemu.c: scope_hint: In function ‘testQemuGetRealCapsInternal’ <built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null # 796| # 797| /* strip 'xml' suffix so that we can format the file to '.replies' */ # 798|-> capsfile[strlen(capsfile) - 3] = '\0'; # 799| # 800| if (schemaCache && schema) { Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/testutilsqemuschema.c:633:21: warning[deadcode.DeadStores]: Although the value stored to 'emptyargs' is used in the enclosing expression, the value is never actually read from 'emptyargs' # 631| # 632| if (!arguments) # 633|-> arguments = emptyargs = virJSONValueNewObject(); # 634| # 635| if (virQEMUQAPISchemaPathGet(schemapatharguments, schema, &schemarootarguments) < 0 || Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/vircgrouptest.c:308:5: warning[deadcode.DeadStores]: Value stored to 'rv' is never read # 306| return -1; # 307| } # 308|-> rv = validateCgroup(cgroup, mountsSmall, links, placementSmall, NULL, NULL, 0); # 309| virCgroupFree(cgroup); # 310| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/vircryptotest.c:81:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'iv' # 79| if (virRandomBytes(enckey, enckeylen) < 0 || # 80| virRandomBytes(iv, ivlen) < 0) { # 81|-> fprintf(stderr, "Failed to generate random bytes\n"); # 82| return -1; # 83| } Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/tests/virhostcputest.c: scope_hint: In function ‘linuxTestCompareFiles’ libvirt-10.4.0-build/libvirt-10.4.0/tests/virhostcputest.c:36:15: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(cpuinfofile, "r")’ # 34| g_autoptr(FILE) cpuinfo = NULL; # 35| # 36|-> cpuinfo = fopen(cpuinfofile, "r"); # 37| if (!cpuinfo) { # 38| fprintf(stderr, "unable to open: %s : %s\n", Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.4.0-build/libvirt-10.4.0/tests/virhostcputest.c:36:15: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(cpuinfofile, "r")’ # 34| g_autoptr(FILE) cpuinfo = NULL; # 35| # 36|-> cpuinfo = fopen(cpuinfofile, "r"); # 37| if (!cpuinfo) { # 38| fprintf(stderr, "unable to open: %s : %s\n", Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/tests/virhostcputest.c: scope_hint: In function ‘linuxCPUStatsCompareFiles’ libvirt-10.4.0-build/libvirt-10.4.0/tests/virhostcputest.c:110:21: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(cpustatfile, "r")’ # 108| int nparams = 0; # 109| # 110|-> if (!(cpustat = fopen(cpustatfile, "r"))) { # 111| virReportSystemError(errno, "failed to open '%s': ", cpustatfile); # 112| goto fail; Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.4.0-build/libvirt-10.4.0/tests/virhostcputest.c:110:21: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(cpustatfile, "r")’ # 108| int nparams = 0; # 109| # 110|-> if (!(cpustat = fopen(cpustatfile, "r"))) { # 111| virReportSystemError(errno, "failed to open '%s': ", cpustatfile); # 112| goto fail; Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/tests/virhostcputest.c: scope_hint: In function ‘hostCPUSignature’ libvirt-10.4.0-build/libvirt-10.4.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.4.0-build/libvirt-10.4.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): libvirt-10.4.0-build/libvirt-10.4.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.4.0-build/libvirt-10.4.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-775): libvirt-10.4.0-build/libvirt-10.4.0/tests/virnetdaemontest.c: scope_hint: In function ‘testExecRestart’ libvirt-10.4.0-build/libvirt-10.4.0/tests/virnetdaemontest.c:293:8: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(fdserver[0], 100)’ # 291| * fairly reasonable in general # 292| */ # 293|-> if (dup2(fdserver[0], 100) < 0 || # 294| dup2(fdserver[1], 101) < 0 || # 295| dup2(fdclient[0], 102) < 0 || Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/tests/virnetdaemontest.c:293:36: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(fdserver[1], 101)’ # 291| * fairly reasonable in general # 292| */ # 293|-> if (dup2(fdserver[0], 100) < 0 || # 294| dup2(fdserver[1], 101) < 0 || # 295| dup2(fdclient[0], 102) < 0 || Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/tests/virnetdaemontest.c:294:36: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(fdclient[0], 102)’ # 292| */ # 293| if (dup2(fdserver[0], 100) < 0 || # 294|-> dup2(fdserver[1], 101) < 0 || # 295| dup2(fdclient[0], 102) < 0 || # 296| dup2(fdclient[1], 103) < 0) { Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.4.0-build/libvirt-10.4.0/tests/virnetdaemontest.c:295:36: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(fdclient[1], 103)’ # 293| if (dup2(fdserver[0], 100) < 0 || # 294| dup2(fdserver[1], 101) < 0 || # 295|-> dup2(fdclient[0], 102) < 0 || # 296| dup2(fdclient[1], 103) < 0) { # 297| virReportSystemError(errno, "%s", "dup2() failed"); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/virnetdevbandwidthtest.c:50:11: warning[deadcode.DeadStores]: Although the value stored to 'doc' is used in the enclosing expression, the value is never actually read from 'doc' # 48| return 0; # 49| # 50|-> if (!(doc = virXMLParseStringCtxt((xml), # 51| "bandwidth definition", # 52| &ctxt))) Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/virnetdevopenvswitchtest.c:58:11: warning[deadcode.DeadStores]: Although the value stored to 'doc' is used in the enclosing expression, the value is never actually read from 'doc' # 56| return 0; # 57| # 58|-> if (!(doc = virXMLParseStringCtxt((xml), # 59| "bandwidth definition", # 60| &ctxt))) Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/virshtest.c:149:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'doc' # 147| # 148| if ((fd = open(pipepath, O_WRONLY)) < 0) { # 149|-> fprintf(stderr, "\nfailed to open pipe '%s': %s\n", pipepath, g_strerror(errno)); # 150| return; # 151| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/virshtest.c:395:5: warning[deadcode.DeadStores]: Value stored to 'need_readline' is never read # 393| DO_TEST_SCRIPT("completion", NULL, VIRSH_DEFAULT); # 394| # 395|-> need_readline = false; # 396| # 397| if (virTestRun("read-big-pipe", testVirshPipe, NULL) < 0) Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/virsystemdtest.c:451:14: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 449| for (i = 0; i < 4; i++) { # 450| g_setenv("RESULT_SUPPORT", results[i], TRUE); # 451|-> if ((rv = data->tested(&result)) < 0) { # 452| fprintf(stderr, "%s", "Unexpected canSuspend error\n"); # 453| return -1; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/xlconfigtest.c:83:21: warning[unix.Malloc]: Potential leak of memory pointed to by 'gotxlcfgData' # 81| if (!(def = virDomainDefParseFile(xml, driver->xmlopt, # 82| NULL, VIR_DOMAIN_XML_INACTIVE))) # 83|-> return -1; # 84| } # 85| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tests/xmconfigtest.c:49:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'gotxmcfgData' # 47| if (!(def = virDomainDefParseFile(xml, driver->xmlopt, NULL, # 48| VIR_DOMAIN_DEF_PARSE_INACTIVE))) # 49|-> return -1; # 50| # 51| if (!virDomainDefCheckABIStability(def, def, driver->xmlopt)) { Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/nss/libvirt_nss.c:267:10: warning[deadcode.DeadStores]: Although the value stored to 'r' is used in the enclosing expression, the value is never actually read from 'r' # 265| af = AF_INET; # 266| # 267|-> if ((r = findLease(name, af, &addr, &naddr, &found, errnop)) < 0) { # 268| /* Error occurred. Return immediately. */ # 269| if (*errnop == EAGAIN) { Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/nss/libvirt_nss.c:377:10: warning[deadcode.DeadStores]: Although the value stored to 'r' is used in the enclosing expression, the value is never actually read from 'r' # 375| char *r_name; # 376| # 377|-> if ((r = findLease(name, AF_UNSPEC, &addr, &naddr, &found, errnop)) < 0) { # 378| /* Error occurred. Return immediately. */ # 379| if (*errnop == EAGAIN) { Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/nss/libvirt_nss_leases.c:89:10: warning[deadcode.DeadStores]: Although the value stored to 'err' is used in the enclosing expression, the value is never actually read from 'err' # 87| hints.ai_flags = AI_NUMERICHOST; # 88| # 89|-> if ((err = getaddrinfo(ipAddr, NULL, &hints, &res)) != 0) { # 90| ERROR("Cannot parse socket address '%s': %s", # 91| ipAddr, gai_strerror(err)); Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.4.0-build/libvirt-10.4.0/tools/nss/libvirt_nss_macs.c: scope_hint: In function ‘findMACsParserString’ libvirt-10.4.0-build/libvirt-10.4.0/tools/nss/libvirt_nss_macs.c:86:12: warning[-Wanalyzer-malloc-leak]: leak of ‘strndup(stringVal, stringLen)’ # 84| # 85| parser->entry.macs = macs; # 86|-> if (!(macs[parser->entry.nmacs++] = strndup((char *)stringVal, stringLen))) # 87| return 0; # 88| } else { Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-checkpoint.c:762:15: warning[deadcode.DeadStores]: Although the value stored to 'xml' is used in the enclosing expression, the value is never actually read from 'xml' # 760| continue; # 761| # 762|-> if (!(xml = virXMLParseStringCtxt(doc, _("(domain_checkpoint)"), &ctxt))) # 763| continue; # 764| Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-completer-checkpoint.c: scope_hint: In function ‘virshCheckpointNameCompleter’ libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-completer-checkpoint.c:69:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’ libvirt-10.4.0-build/libvirt-10.4.0/tools/vsh.h:28: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-completer-checkpoint.h:23: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-completer-checkpoint.c:23: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-completer-checkpoint.c:39:5: note: in expansion of macro ‘virCheckFlags’ # 67| g_free(checkpoints); # 68| for (i = 0; i < ncheckpoints; i++) # 69|-> g_free(ret[i]); # 70| g_free(ret); # 71| return NULL; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-completer-domain.c:132:14: warning[unix.Malloc]: Potential leak of memory pointed to by 'tmp' # 130| # 131| cleanup: # 132|-> for (i = 0; i < ndomains; i++) # 133| virshDomainFree(domains[i]); # 134| g_free(domains); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-completer-domain.c:180:20: warning[unix.Malloc]: Potential leak of memory pointed to by 'tmp' # 178| * <target dev=''/>. Offer MAC addresses then. */ # 179| if (!(tmp[i] = virXPathString("string(./mac/@address)", ctxt))) # 180|-> return NULL; # 181| } # 182| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-completer-domain.c:217:20: warning[unix.Malloc]: Potential leak of memory pointed to by 'tmp' # 215| ctxt->node = disks[i]; # 216| if (!(tmp[i] = virXPathString("string(./target/@dev)", ctxt))) # 217|-> return NULL; # 218| } # 219| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-completer-domain.c:449:20: warning[unix.Malloc]: Potential leak of memory pointed to by 'tmp' # 447| for (i = 0; i < naliases; i++) { # 448| if (!(tmp[i] = virXMLPropString(aliases[i], "name"))) # 449|-> return NULL; # 450| } # 451| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-completer-host.c:78:11: warning[deadcode.DeadStores]: Although the value stored to 'doc' is used in the enclosing expression, the value is never actually read from 'doc' # 76| return NULL; # 77| # 78|-> if (!(doc = virXMLParseStringCtxt(cap_xml, _("capabilities"), &ctxt))) # 79| return NULL; # 80| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-completer-host.c:125:11: warning[deadcode.DeadStores]: Although the value stored to 'doc' is used in the enclosing expression, the value is never actually read from 'doc' # 123| return NULL; # 124| # 125|-> if (!(doc = virXMLParseStringCtxt(cap_xml, _("capabilities"), &ctxt))) # 126| return NULL; # 127| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-completer-host.c:136:20: warning[unix.Malloc]: Potential leak of memory pointed to by 'tmp' # 134| for (i = 0; i < ncells; i++) { # 135| if (!(tmp[i] = virXMLPropString(cells[i], "id"))) # 136|-> return NULL; # 137| } # 138| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-completer-host.c:243:11: warning[deadcode.DeadStores]: Although the value stored to 'xml' is used in the enclosing expression, the value is never actually read from 'xml' # 241| return NULL; # 242| # 243|-> if (!(xml = virXMLParseStringCtxt(domcaps, _("domain capabilities"), &ctxt))) # 244| return NULL; # 245| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-completer-network.c:172:14: warning[unix.Malloc]: Potential leak of memory pointed to by 'tmp' # 170| # 171| cleanup: # 172|-> for (i = 0; i < nnets; i++) # 173| virshNetworkFree(nets[i]); # 174| g_free(nets); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-completer-secret.c:61:14: warning[unix.Malloc]: Potential leak of memory pointed to by 'tmp' # 59| # 60| cleanup: # 61|-> for (i = 0; i < nsecrets; i++) # 62| virshSecretFree(secrets[i]); # 63| g_free(secrets); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-completer-volume.c:115:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'tmp' # 113| # 114| cleanup: # 115|-> virshStoragePoolListFree(list); # 116| return ret; # 117| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-domain-monitor.c:1938:17: warning[deadcode.DeadStores]: Value stored to 'sep' is never read # 1936| if (optName) { # 1937| vshPrint(ctl, "%s%s", sep, virDomainGetName(dom)); # 1938|-> sep = " "; # 1939| } # 1940| vshPrint(ctl, "\n"); Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-domain.c: scope_hint: In function ‘virshAddressParse’ libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-domain.c:125:15: warning[-Wanalyzer-null-argument]: use of NULL 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.4.0-build/libvirt-10.4.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:30: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh.h:25: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-domain.h:23: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-domain.c:22: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-domain.c:124:29: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-domain.c: scope_hint: In function ‘virshAddressParse’ <built-in>: note: argument 1 of ‘__builtin_strchr’ must be non-null # 123| { # 124| g_autofree char *type = g_strdup(str); # 125|-> char *a = strchr(type, ':'); # 126| # 127| if (!a) Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-domain.c: scope_hint: In function ‘getSignalNumber’ libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-domain.c:8652:24: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘signame’ libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-domain.c:8649:28: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-domain.c: scope_hint: In function ‘getSignalNumber’ # 8650| char *p = str; # 8651| # 8652|-> for (i = 0; signame[i]; i++) # 8653| p[i] = g_ascii_tolower(signame[i]); # 8654| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-host.c:252:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'nodes_free' # 250| } # 251| # 252|-> vshPrintExtra(ctl, "--------------------\n"); # 253| vshPrintExtra(ctl, "%5s: %10llu KiB\n", _("Total"), memory/1024); # 254| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-host.c:252:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'nodes_id' # 250| } # 251| # 252|-> vshPrintExtra(ctl, "--------------------\n"); # 253| vshPrintExtra(ctl, "%5s: %10llu KiB\n", _("Total"), memory/1024); # 254| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-host.c:335:15: warning[deadcode.DeadStores]: Although the value stored to 'doc' is used in the enclosing expression, the value is never actually read from 'doc' # 333| } # 334| # 335|-> if (!(doc = virXMLParseStringCtxt(cap_xml, _("capabilities"), &ctxt))) { # 336| vshError(ctl, "%s", _("unable to parse node capabilities")); # 337| goto cleanup; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-host.c:459:12: warning[unix.Malloc]: Potential leak of memory pointed to by 'counts' # 457| } # 458| # 459|-> ret = !pagesize_missing; # 460| cleanup: # 461| VIR_FREE(nodes); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-host.c:459:12: warning[unix.Malloc]: Potential leak of memory pointed to by 'pagesize' # 457| } # 458| # 459|-> ret = !pagesize_missing; # 460| cleanup: # 461| VIR_FREE(nodes); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-host.c:613:15: warning[deadcode.DeadStores]: Although the value stored to 'xml' is used in the enclosing expression, the value is never actually read from 'xml' # 611| if ((caps = virConnectGetDomainCapabilities(priv->conn, NULL, NULL, NULL, # 612| type, 0))) { # 613|-> if (!(xml = virXMLParseStringCtxt(caps, _("(domainCapabilities)"), &ctxt))) # 614| return false; # 615| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-host.c:1147:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'cpus' # 1145| # 1146| if (!(cpus[i] = virXMLNodeToString(xml, nodes[i]))) { # 1147|-> vshSaveLibvirtError(); # 1148| return NULL; # 1149| } Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-interface.c:777:10: warning[deadcode.DeadStores]: Although the value stored to 'br_handle' is used in the enclosing expression, the value is never actually read from 'br_handle' # 775| # 776| /* make sure "new" device doesn't already exist */ # 777|-> if ((br_handle = virInterfaceLookupByName(priv->conn, br_name))) { # 778| vshError(ctl, _("Network device %1$s already exists"), br_name); # 779| goto cleanup; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-pool.c:497:11: warning[deadcode.DeadStores]: Although the value stored to 'pool' is used in the enclosing expression, the value is never actually read from 'pool' # 495| } # 496| # 497|-> if (!(pool = virStoragePoolCreateXML(priv->conn, xml, flags))) { # 498| vshError(ctl, _("Failed to create pool %1$s"), name); # 499| return false; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-pool.c:577:11: warning[deadcode.DeadStores]: Although the value stored to 'pool' is used in the enclosing expression, the value is never actually read from 'pool' # 575| } # 576| # 577|-> if (!(pool = virStoragePoolDefineXML(priv->conn, xml, 0))) { # 578| vshError(ctl, _("Failed to define pool %1$s"), name); # 579| return false; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-pool.c:1765:11: warning[deadcode.DeadStores]: Although the value stored to 'tmp_desc' is used in the enclosing expression, the value is never actually read from 'tmp_desc' # 1763| # 1764| /* Some old daemons don't support _INACTIVE flag */ # 1765|-> if (!(tmp_desc = virStoragePoolGetXMLDesc(pool, flags))) { # 1766| if (last_error->code == VIR_ERR_INVALID_ARG) { # 1767| flags &= ~VIR_STORAGE_XML_INACTIVE; Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-secret.c: scope_hint: In function ‘cmdSecretSetValue’ libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-secret.c:240:22: warning[-Wanalyzer-null-argument]: use of NULL ‘secret_val’ where non-null expected libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:58: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/tools/vsh.h:28: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-secret.h:23: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-secret.c:22: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-secret.c:238:23: note: in expansion of macro ‘_’ /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.4.0-build/libvirt-10.4.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:30: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-secret.c:239:22: note: in expansion of macro ‘g_strdup’ libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-secret.c: scope_hint: In function ‘cmdSecretSetValue’ <built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null # 238| vshError(ctl, _("Passing secret value as command-line argument is insecure!")); # 239| secret_val = g_strdup(base64); # 240|-> secret_len = strlen(secret_val); # 241| } else if (filename) { # 242| ssize_t read_ret; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-snapshot.c:652:15: warning[deadcode.DeadStores]: Although the value stored to 'snapshot2' is used in the enclosing expression, the value is never actually read from 'snapshot2' # 650| flags |= VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY; # 651| # 652|-> if (!(snapshot2 = virDomainSnapshotCreateXML(dom, xml, flags))) # 653| goto cleanup; # 654| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-snapshot.c:1523:15: warning[deadcode.DeadStores]: Although the value stored to 'xml' is used in the enclosing expression, the value is never actually read from 'xml' # 1521| continue; # 1522| # 1523|-> if (!(xml = virXMLParseStringCtxt(doc, _("(domain_snapshot)"), &ctxt))) # 1524| continue; # 1525| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-util.c:207:25: warning[unix.Malloc]: Potential leak of memory pointed to by 'buf' # 205| # 206| if ((r = safewrite(cbData->fd, buf, count)) < 0) # 207|-> return -1; # 208| # 209| offset -= r; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-volume.c:356:15: warning[deadcode.DeadStores]: Although the value stored to 'vol' is used in the enclosing expression, the value is never actually read from 'vol' # 354| vshPrint(ctl, "%s", xml); # 355| } else { # 356|-> if (!(vol = virStorageVolCreateXML(pool, xml, flags))) { # 357| vshError(ctl, _("Failed to create vol %1$s"), name); # 358| return false; Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-volume.c: scope_hint: In function ‘cmdVolList’ libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-volume.c:1381:17: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘volInfoTexts’ # 1379| # 1380| for (i = 0; i < list->nvols; i++) { # 1381|-> if (vshTableRowAppend(table, # 1382| virStorageVolGetName(list->vols[i]), # 1383| volInfoTexts[i].path, Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.4.0-build/libvirt-10.4.0/tools/virsh-volume.c:1404:13: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘volInfoTexts’ # 1402| /* Insert the volume info rows into table */ # 1403| for (i = 0; i < list->nvols; i++) { # 1404|-> if (vshTableRowAppend(table, # 1405| virStorageVolGetName(list->vols[i]), # 1406| volInfoTexts[i].path, Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virt-login-shell-helper.c:348:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'shargv' # 346| shcmd = shargv[0]; # 347| if (!g_path_is_absolute(shcmd)) { # 348|-> virReportSystemError(errno, # 349| _("Shell '%1$s' should have absolute path"), # 350| shcmd); Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virt-login-shell-helper.c:394:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'shargv' # 392| * but as that may take a long time, we release resources now. */ # 393| cleanup: # 394|-> saved_err = virSaveLastError(); # 395| # 396| if (nfdlist > 0) Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virt-pki-query-dn.c:70:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'dname' # 68| # 69| if (virGettextInitialize() < 0) # 70|-> return EXIT_FAILURE; # 71| # 72| if (!(progname = strrchr(argv[0], '/'))) Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/virt-pki-query-dn.c:132:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'dname' # 130| } # 131| if (rv != 0) { # 132|-> g_printerr(_("Failed to get distinguished name: %1$s\n"), # 133| gnutls_strerror(rv)); # 134| return EXIT_FAILURE; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/vsh-table.c:388:11: warning[unix.Malloc]: Potential leak of memory pointed to by 'maxwidths' # 386| vshTableRowPrint(table->rows[i], maxwidths, widths[i], &buf); # 387| # 388|-> ret = virBufferContentAndReset(&buf); # 389| # 390| cleanup: Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/vsh.c:1094:14: warning[core.NullDereference]: Access to field 'data' results in a dereference of a null pointer (loaded from variable 'arg') # 1092| } # 1093| # 1094|-> *value = arg->data; # 1095| return 0; # 1096| } Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.4.0-build/libvirt-10.4.0/tools/vsh.c: scope_hint: In function ‘vshCommandOptArgvString’ libvirt-10.4.0-build/libvirt-10.4.0/tools/vsh.c:1283:13: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘opt’ /usr/include/bits/types/struct_iovec.h:23: included_from: Included from here. /usr/include/bits/fcntl-linux.h:38: included_from: Included from here. /usr/include/bits/fcntl.h:61: included_from: Included from here. /usr/include/fcntl.h:35: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/tools/vsh.c:27: included_from: Included from here. /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.4.0-build/libvirt-10.4.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/src/internal.h:30: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/tools/vsh.h:28: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/tools/vsh.c:22: included_from: Included from here. libvirt-10.4.0-build/libvirt-10.4.0/tools/vsh.c:3536:28: note: in expansion of macro ‘g_strdup’ # 1281| return NULL; # 1282| # 1283|-> if (!opt->argvstr) # 1284| opt->argvstr = g_strjoinv(" ", opt->argv); # 1285| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/vsh.c:1448:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'c' # 1446| # 1447| if (!(c->def = vshCmddefSearch(cmdname))) { # 1448|-> if (report) # 1449| vshError(ctl, _("unknown command: '%1$s'"), cmdname); # 1450| Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/vsh.c:2346:17: warning[deadcode.DeadStores]: Value stored to 'lvl' during its initialization is never read # 2344| g_autofree char *str = NULL; # 2345| size_t len; # 2346|-> const char *lvl = ""; # 2347| g_autoptr(GDateTime) now = g_date_time_new_now_local(); # 2348| g_autofree gchar *nowstr = NULL; Error: CLANG_WARNING: libvirt-10.4.0-build/libvirt-10.4.0/tools/vsh.c:3287:15: warning[deadcode.DeadStores]: Although the value stored to 'dir_malloced' is used in the enclosing expression, the value is never actually read from 'dir_malloced' # 3285| # 3286| if (vshCommandOptStringQuiet(ctl, cmd, "dir", &dir) <= 0) # 3287|-> dir = dir_malloced = virGetUserDirectory(); # 3288| if (!dir) # 3289| dir = "/";