Task #228 - libvirt-10.1.0-1.fc41/scan-results.err
back to task #228download
Error: SHELLCHECK_WARNING (CWE-398): /usr/bin/virt-pki-validate:208:64: warning[SC1010]: Use semicolon or linefeed before 'do' (or quote to make it literal). # 206| if [ "$ORG" != "$C_ORG" ] # 207| then # 208|-> echo The CA certificate and the client certificate do not match # 209| echo CA organization: $ORG # 210| echo Client organization: $C_ORG Error: SHELLCHECK_WARNING (CWE-398): /usr/bin/virt-pki-validate:255:64: warning[SC1010]: Use semicolon or linefeed before 'do' (or quote to make it literal). # 253| if [ "$ORG" != "$S_ORG" ] # 254| then # 255|-> echo The CA certificate and the server certificate do not match # 256| echo CA organization: $ORG # 257| echo Server organization: $S_ORG Error: SHELLCHECK_WARNING (CWE-156): /usr/bin/virt-pki-validate:263:31: warning[SC2046]: Quote this to prevent word splitting. # 261| then # 262| echo The server certificate does not seem to match the host name # 263|-> echo hostname: '"'`hostname`'"' # 264| echo Server certificate CN: '"'$S_HOST'"' # 265| fi Error: SHELLCHECK_WARNING (CWE-398): /usr/i686-w64-mingw32/sys-root/mingw/bin/virt-pki-validate:208:64: warning[SC1010]: Use semicolon or linefeed before 'do' (or quote to make it literal). # 206| if [ "$ORG" != "$C_ORG" ] # 207| then # 208|-> echo The CA certificate and the client certificate do not match # 209| echo CA organization: $ORG # 210| echo Client organization: $C_ORG Error: SHELLCHECK_WARNING (CWE-398): /usr/i686-w64-mingw32/sys-root/mingw/bin/virt-pki-validate:255:64: warning[SC1010]: Use semicolon or linefeed before 'do' (or quote to make it literal). # 253| if [ "$ORG" != "$S_ORG" ] # 254| then # 255|-> echo The CA certificate and the server certificate do not match # 256| echo CA organization: $ORG # 257| echo Server organization: $S_ORG Error: SHELLCHECK_WARNING (CWE-156): /usr/i686-w64-mingw32/sys-root/mingw/bin/virt-pki-validate:263:31: warning[SC2046]: Quote this to prevent word splitting. # 261| then # 262| echo The server certificate does not seem to match the host name # 263|-> echo hostname: '"'`hostname`'"' # 264| echo Server certificate CN: '"'$S_HOST'"' # 265| fi Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:68:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 66| # (using libvirt's default connection) # 67| run_virsh() { # 68|-> local uri="$1" # 69| shift # 70| Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:89:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 87| test_connect() # 88| { # 89|-> local uri="$1" # 90| # 91| if run_virsh "$uri" connect 2>/dev/null; then Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:106:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 104| # [none]: list both persistent and transient guests # 105| list_guests() { # 106|-> local uri="$1" # 107| local persistent="$2" # 108| local list="$(run_virsh_c "$uri" list --uuid $persistent)" Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:107:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 105| list_guests() { # 106| local uri="$1" # 107|-> local persistent="$2" # 108| local list="$(run_virsh_c "$uri" list --uuid $persistent)" # 109| Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:108:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 106| local uri="$1" # 107| local persistent="$2" # 108|-> local list="$(run_virsh_c "$uri" list --uuid $persistent)" # 109| # 110| if [ $? -ne 0 ]; then Error: SHELLCHECK_WARNING (CWE-571): /usr/libexec/libvirt-guests.sh:108:11: warning[SC2155]: Declare and assign separately to avoid masking return values. # 106| local uri="$1" # 107| local persistent="$2" # 108|-> local list="$(run_virsh_c "$uri" list --uuid $persistent)" # 109| # 110| if [ $? -ne 0 ]; then Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:121:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 119| # return name of guest UUID on URI # 120| guest_name() { # 121|-> local uri="$1" # 122| local uuid="$2" # 123| Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:122:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 120| guest_name() { # 121| local uri="$1" # 122|-> local uuid="$2" # 123| # 124| run_virsh "$uri" domname "$uuid" 2>/dev/null Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:131:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 129| # Result is returned by variable "guest_running" # 130| guest_is_on() { # 131|-> local uri="$1" # 132| local uuid="$2" # 133| local id="$(run_virsh "$uri" domid "$uuid")" Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:132:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 130| guest_is_on() { # 131| local uri="$1" # 132|-> local uuid="$2" # 133| local id="$(run_virsh "$uri" domid "$uuid")" # 134| Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:133:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 131| local uri="$1" # 132| local uuid="$2" # 133|-> local id="$(run_virsh "$uri" domid "$uuid")" # 134| # 135| guest_running="false" Error: SHELLCHECK_WARNING (CWE-571): /usr/libexec/libvirt-guests.sh:133:11: warning[SC2155]: Declare and assign separately to avoid masking return values. # 131| local uri="$1" # 132| local uuid="$2" # 133|-> local id="$(run_virsh "$uri" domid "$uuid")" # 134| # 135| guest_running="false" Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:154:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 152| # Start or resume the guests # 153| start() { # 154|-> local isfirst="true" # 155| local bypass= # 156| local sync_time="false" Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:155:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 153| start() { # 154| local isfirst="true" # 155|-> local bypass= # 156| local sync_time="false" # 157| local uri= Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:156:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 154| local isfirst="true" # 155| local bypass= # 156|-> local sync_time="false" # 157| local uri= # 158| local list= Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:157:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 155| local bypass= # 156| local sync_time="false" # 157|-> local uri= # 158| local list= # 159| Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:158:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 156| local sync_time="false" # 157| local uri= # 158|-> local list= # 159| # 160| [ -f "$LISTFILE" ] || { started; return 0; } Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:173:9: warning[SC3043]: In POSIX sh, 'local' is undefined. # 171| test "x$SYNC_TIME" = x0 || sync_time="true" # 172| while read uri list; do # 173|-> local configured="false" # 174| local confuri= # 175| local guest= Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:174:9: warning[SC3043]: In POSIX sh, 'local' is undefined. # 172| while read uri list; do # 173| local configured="false" # 174|-> local confuri= # 175| local guest= # 176| Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:175:9: warning[SC3043]: In POSIX sh, 'local' is undefined. # 173| local configured="false" # 174| local confuri= # 175|-> local guest= # 176| # 177| set -f Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:195:13: warning[SC3043]: In POSIX sh, 'local' is undefined. # 193| eval_gettext "Resuming guests on \$uri URI..."; echo # 194| for guest in $list; do # 195|-> local name="$(guest_name "$uri" "$guest")" # 196| eval_gettext "Resuming guest \$name: " # 197| if guest_is_on "$uri" "$guest"; then Error: SHELLCHECK_WARNING (CWE-571): /usr/libexec/libvirt-guests.sh:195:19: warning[SC2155]: Declare and assign separately to avoid masking return values. # 193| eval_gettext "Resuming guests on \$uri URI..."; echo # 194| for guest in $list; do # 195|-> local name="$(guest_name "$uri" "$guest")" # 196| eval_gettext "Resuming guest \$name: " # 197| if guest_is_on "$uri" "$guest"; then Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:226:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 224| suspend_guest() # 225| { # 226|-> local uri="$1" # 227| local guest="$2" # 228| local name="$(guest_name "$uri" "$guest")" Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:227:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 225| { # 226| local uri="$1" # 227|-> local guest="$2" # 228| local name="$(guest_name "$uri" "$guest")" # 229| local label="$(eval_gettext "Suspending \$name: ")" Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:228:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 226| local uri="$1" # 227| local guest="$2" # 228|-> local name="$(guest_name "$uri" "$guest")" # 229| local label="$(eval_gettext "Suspending \$name: ")" # 230| local bypass= Error: SHELLCHECK_WARNING (CWE-571): /usr/libexec/libvirt-guests.sh:228:11: warning[SC2155]: Declare and assign separately to avoid masking return values. # 226| local uri="$1" # 227| local guest="$2" # 228|-> local name="$(guest_name "$uri" "$guest")" # 229| local label="$(eval_gettext "Suspending \$name: ")" # 230| local bypass= Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:229:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 227| local guest="$2" # 228| local name="$(guest_name "$uri" "$guest")" # 229|-> local label="$(eval_gettext "Suspending \$name: ")" # 230| local bypass= # 231| local slept=0 Error: SHELLCHECK_WARNING (CWE-571): /usr/libexec/libvirt-guests.sh:229:11: warning[SC2155]: Declare and assign separately to avoid masking return values. # 227| local guest="$2" # 228| local name="$(guest_name "$uri" "$guest")" # 229|-> local label="$(eval_gettext "Suspending \$name: ")" # 230| local bypass= # 231| local slept=0 Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:230:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 228| local name="$(guest_name "$uri" "$guest")" # 229| local label="$(eval_gettext "Suspending \$name: ")" # 230|-> local bypass= # 231| local slept=0 # 232| Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:231:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 229| local label="$(eval_gettext "Suspending \$name: ")" # 230| local bypass= # 231|-> local slept=0 # 232| # 233| test "x$BYPASS_CACHE" = x0 || bypass="--bypass-cache" Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:236:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 234| printf '%s...\n' "$label" # 235| run_virsh "$uri" managedsave $bypass "$guest" >/dev/null & # 236|-> local virsh_pid="$!" # 237| while true; do # 238| sleep 1 Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:243:13: warning[SC3043]: In POSIX sh, 'local' is undefined. # 241| slept=$(($slept + 1)) # 242| if [ $(($slept % 5)) -eq 0 ]; then # 243|-> local progress="$(run_virsh_c "$uri" domjobinfo "$guest" 2>/dev/null | \ # 244| awk '/^Data processed:/{print $3, $4}')" # 245| if [ -n "$progress" ]; then Error: SHELLCHECK_WARNING (CWE-571): /usr/libexec/libvirt-guests.sh:243:19: warning[SC2155]: Declare and assign separately to avoid masking return values. # 241| slept=$(($slept + 1)) # 242| if [ $(($slept % 5)) -eq 0 ]; then # 243|-> local progress="$(run_virsh_c "$uri" domjobinfo "$guest" 2>/dev/null | \ # 244| awk '/^Data processed:/{print $3, $4}')" # 245| if [ -n "$progress" ]; then Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:260:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 258| shutdown_guest() # 259| { # 260|-> local uri="$1" # 261| local guest="$2" # 262| local name="$(guest_name "$uri" "$guest")" Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:261:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 259| { # 260| local uri="$1" # 261|-> local guest="$2" # 262| local name="$(guest_name "$uri" "$guest")" # 263| local timeout="$SHUTDOWN_TIMEOUT" Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:262:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 260| local uri="$1" # 261| local guest="$2" # 262|-> local name="$(guest_name "$uri" "$guest")" # 263| local timeout="$SHUTDOWN_TIMEOUT" # 264| local check_timeout="false" Error: SHELLCHECK_WARNING (CWE-571): /usr/libexec/libvirt-guests.sh:262:11: warning[SC2155]: Declare and assign separately to avoid masking return values. # 260| local uri="$1" # 261| local guest="$2" # 262|-> local name="$(guest_name "$uri" "$guest")" # 263| local timeout="$SHUTDOWN_TIMEOUT" # 264| local check_timeout="false" Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:263:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 261| local guest="$2" # 262| local name="$(guest_name "$uri" "$guest")" # 263|-> local timeout="$SHUTDOWN_TIMEOUT" # 264| local check_timeout="false" # 265| local format= Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:264:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 262| local name="$(guest_name "$uri" "$guest")" # 263| local timeout="$SHUTDOWN_TIMEOUT" # 264|-> local check_timeout="false" # 265| local format= # 266| local slept= Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:265:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 263| local timeout="$SHUTDOWN_TIMEOUT" # 264| local check_timeout="false" # 265|-> local format= # 266| local slept= # 267| Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:266:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 264| local check_timeout="false" # 265| local format= # 266|-> local slept= # 267| # 268| eval_gettext "Starting shutdown on guest: \$name" Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:312:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 310| shutdown_guest_async() # 311| { # 312|-> local uri="$1" # 313| local guest="$2" # 314| local name="$(guest_name "$uri" "$guest")" Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:313:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 311| { # 312| local uri="$1" # 313|-> local guest="$2" # 314| local name="$(guest_name "$uri" "$guest")" # 315| Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:314:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 312| local uri="$1" # 313| local guest="$2" # 314|-> local name="$(guest_name "$uri" "$guest")" # 315| # 316| eval_gettext "Starting shutdown on guest: \$name" Error: SHELLCHECK_WARNING (CWE-571): /usr/libexec/libvirt-guests.sh:314:11: warning[SC2155]: Declare and assign separately to avoid masking return values. # 312| local uri="$1" # 313| local guest="$2" # 314|-> local name="$(guest_name "$uri" "$guest")" # 315| # 316| eval_gettext "Starting shutdown on guest: \$name" Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:335:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 333| check_guests_shutdown() # 334| { # 335|-> local uri="$1" # 336| local guests_to_check="$2" # 337| local guest= Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:336:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 334| { # 335| local uri="$1" # 336|-> local guests_to_check="$2" # 337| local guest= # 338| Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:337:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 335| local uri="$1" # 336| local guests_to_check="$2" # 337|-> local guest= # 338| # 339| guests_shutting_down= Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:357:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 355| print_guests_shutdown() # 356| { # 357|-> local uri="$1" # 358| local before="$2" # 359| local after="$3" Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:358:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 356| { # 357| local uri="$1" # 358|-> local before="$2" # 359| local after="$3" # 360| local guest= Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:359:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 357| local uri="$1" # 358| local before="$2" # 359|-> local after="$3" # 360| local guest= # 361| Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:360:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 358| local before="$2" # 359| local after="$3" # 360|-> local guest= # 361| # 362| for guest in $before; do Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:367:9: warning[SC3043]: In POSIX sh, 'local' is undefined. # 365| esac # 366| # 367|-> local name="$(guest_name "$uri" "$guest")" # 368| if [ -n "$name" ]; then # 369| eval_gettext "Shutdown of guest \$name complete." Error: SHELLCHECK_WARNING (CWE-571): /usr/libexec/libvirt-guests.sh:367:15: warning[SC2155]: Declare and assign separately to avoid masking return values. # 365| esac # 366| # 367|-> local name="$(guest_name "$uri" "$guest")" # 368| if [ -n "$name" ]; then # 369| eval_gettext "Shutdown of guest \$name complete." Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:379:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 377| shutdown_guests_parallel() # 378| { # 379|-> local uri="$1" # 380| local guests="$2" # 381| local on_shutdown= Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:380:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 378| { # 379| local uri="$1" # 380|-> local guests="$2" # 381| local on_shutdown= # 382| local check_timeout="false" Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:381:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 379| local uri="$1" # 380| local guests="$2" # 381|-> local on_shutdown= # 382| local check_timeout="false" # 383| local timeout="$SHUTDOWN_TIMEOUT" Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:382:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 380| local guests="$2" # 381| local on_shutdown= # 382|-> local check_timeout="false" # 383| local timeout="$SHUTDOWN_TIMEOUT" # 384| local slept= Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:383:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 381| local on_shutdown= # 382| local check_timeout="false" # 383|-> local timeout="$SHUTDOWN_TIMEOUT" # 384| local slept= # 385| local format= Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:384:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 382| local check_timeout="false" # 383| local timeout="$SHUTDOWN_TIMEOUT" # 384|-> local slept= # 385| local format= # 386| Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:385:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 383| local timeout="$SHUTDOWN_TIMEOUT" # 384| local slept= # 385|-> local format= # 386| # 387| if [ $timeout -gt 0 ]; then Error: SHELLCHECK_WARNING (CWE-156): /usr/libexec/libvirt-guests.sh:396:17: warning[SC2046]: Quote this to prevent word splitting. # 394| while [ -n "$on_shutdown" ] || [ -n "$guests" ]; do # 395| while [ -n "$guests" ] && # 396|-> [ $(guest_count "$on_shutdown") -lt "$PARALLEL_SHUTDOWN" ]; do # 397| set -- $guests # 398| local guest="$1" Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:398:13: warning[SC3043]: In POSIX sh, 'local' is undefined. # 396| [ $(guest_count "$on_shutdown") -lt "$PARALLEL_SHUTDOWN" ]; do # 397| set -- $guests # 398|-> local guest="$1" # 399| shift # 400| guests="$*" Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:410:9: warning[SC3043]: In POSIX sh, 'local' is undefined. # 408| # 409| set -- $guests # 410|-> local guestcount=$# # 411| set -- $on_shutdown # 412| local shutdowncount=$# Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:412:9: warning[SC3043]: In POSIX sh, 'local' is undefined. # 410| local guestcount=$# # 411| set -- $on_shutdown # 412|-> local shutdowncount=$# # 413| # 414| if $check_timeout; then Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:431:9: warning[SC3043]: In POSIX sh, 'local' is undefined. # 429| fi # 430| # 431|-> local on_shutdown_prev="$on_shutdown" # 432| check_guests_shutdown "$uri" "$on_shutdown" # 433| on_shutdown="$guests_shutting_down" Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:441:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 439| # Shutdown or save guests on the configured uris # 440| stop() { # 441|-> local suspending="true" # 442| local uri= # 443| Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:442:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 440| stop() { # 441| local suspending="true" # 442|-> local uri= # 443| # 444| # last stop was not followed by start Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:466:9: warning[SC3043]: In POSIX sh, 'local' is undefined. # 464| eval_gettext "Running guests on \$uri URI: " # 465| # 466|-> local list="$(list_guests "$uri")" # 467| if [ $? -eq 0 ]; then # 468| local empty=true Error: SHELLCHECK_WARNING (CWE-571): /usr/libexec/libvirt-guests.sh:466:15: warning[SC2155]: Declare and assign separately to avoid masking return values. # 464| eval_gettext "Running guests on \$uri URI: " # 465| # 466|-> local list="$(list_guests "$uri")" # 467| if [ $? -eq 0 ]; then # 468| local empty=true Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:468:13: warning[SC3043]: In POSIX sh, 'local' is undefined. # 466| local list="$(list_guests "$uri")" # 467| if [ $? -eq 0 ]; then # 468|-> local empty=true # 469| for uuid in $list; do # 470| "$empty" || printf ", " Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:482:13: warning[SC3043]: In POSIX sh, 'local' is undefined. # 480| # 481| if "$suspending"; then # 482|-> local transient="$(list_guests "$uri" "--transient")" # 483| if [ $? -eq 0 ]; then # 484| local empty="true" Error: SHELLCHECK_WARNING (CWE-571): /usr/libexec/libvirt-guests.sh:482:19: warning[SC2155]: Declare and assign separately to avoid masking return values. # 480| # 481| if "$suspending"; then # 482|-> local transient="$(list_guests "$uri" "--transient")" # 483| if [ $? -eq 0 ]; then # 484| local empty="true" Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:484:17: warning[SC3043]: In POSIX sh, 'local' is undefined. # 482| local transient="$(list_guests "$uri" "--transient")" # 483| if [ $? -eq 0 ]; then # 484|-> local empty="true" # 485| local uuid= # 486| Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:485:17: warning[SC3043]: In POSIX sh, 'local' is undefined. # 483| if [ $? -eq 0 ]; then # 484| local empty="true" # 485|-> local uuid= # 486| # 487| for uuid in $transient; do Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:533:17: warning[SC3043]: In POSIX sh, 'local' is undefined. # 531| shutdown_guests_parallel "$uri" "$list" # 532| else # 533|-> local guest= # 534| for guest in $list; do # 535| if "$suspending"; then Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:553:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 551| # List status of guests # 552| gueststatus() { # 553|-> local uri= # 554| set -f # 555| for uri in $URIS; do Error: SHELLCHECK_WARNING: /usr/libexec/libvirt-guests.sh:585:5: warning[SC3043]: In POSIX sh, 'local' is undefined. # 583| # Display usage string, then exit with VAL (defaults to 2). # 584| usage() { # 585|-> local program_name="$0" # 586| eval_gettext "Usage: \$program_name {start|stop|status|restart|"\ # 587| "condrestart|try-restart|reload|force-reload|gueststatus|shutdown}"; echo Error: SHELLCHECK_WARNING (CWE-563): /usr/libexec/libvirt-guests.sh:585:11: warning[SC2034]: program_name appears unused. Verify use (or export if used externally). # 583| # Display usage string, then exit with VAL (defaults to 2). # 584| usage() { # 585|-> local program_name="$0" # 586| eval_gettext "Usage: \$program_name {start|stop|status|restart|"\ # 587| "condrestart|try-restart|reload|force-reload|gueststatus|shutdown}"; echo Error: SHELLCHECK_WARNING (CWE-149): /usr/libexec/libvirt-guests.sh:586:69: warning[SC2140]: Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"? # 584| usage() { # 585| local program_name="$0" # 586|-> eval_gettext "Usage: \$program_name {start|stop|status|restart|"\ # 587| "condrestart|try-restart|reload|force-reload|gueststatus|shutdown}"; echo # 588| exit ${1-2} Error: SHELLCHECK_WARNING (CWE-398): /usr/x86_64-w64-mingw32/sys-root/mingw/bin/virt-pki-validate:208:64: warning[SC1010]: Use semicolon or linefeed before 'do' (or quote to make it literal). # 206| if [ "$ORG" != "$C_ORG" ] # 207| then # 208|-> echo The CA certificate and the client certificate do not match # 209| echo CA organization: $ORG # 210| echo Client organization: $C_ORG Error: SHELLCHECK_WARNING (CWE-398): /usr/x86_64-w64-mingw32/sys-root/mingw/bin/virt-pki-validate:255:64: warning[SC1010]: Use semicolon or linefeed before 'do' (or quote to make it literal). # 253| if [ "$ORG" != "$S_ORG" ] # 254| then # 255|-> echo The CA certificate and the server certificate do not match # 256| echo CA organization: $ORG # 257| echo Server organization: $S_ORG Error: SHELLCHECK_WARNING (CWE-156): /usr/x86_64-w64-mingw32/sys-root/mingw/bin/virt-pki-validate:263:31: warning[SC2046]: Quote this to prevent word splitting. # 261| then # 262| echo The server certificate does not seem to match the host name # 263|-> echo hostname: '"'`hostname`'"' # 264| echo Server certificate CN: '"'$S_HOST'"' # 265| fi Error: CLANG_WARNING: libvirt-10.1.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: GCC_ANALYZER_WARNING (CWE-479): libvirt-10.1.0/examples/c/misc/event-test.c: scope_hint: In function ‘stop’ libvirt-10.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.0/redhat-linux-build/src/access/viraccessapicheck.c:7433:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 7431| } # 7432| # 7433|-> if ((rv = virAccessManagerCheckNetworkPort(mgr, conn->driver->name, net, port, VIR_ACCESS_PERM_NETWORK_PORT_GETATTR)) <= 0) { # 7434| virObjectUnref(mgr); # 7435| virResetLastError(); Error: CLANG_WARNING: libvirt-10.1.0/redhat-linux-build/src/access/viraccessapicheck.c:8439:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 8437| } # 8438| # 8439|-> if ((rv = virAccessManagerCheckNodeDevice(mgr, conn->driver->name, device, VIR_ACCESS_PERM_NODE_DEVICE_GETATTR)) <= 0) { # 8440| virObjectUnref(mgr); # 8441| virResetLastError(); Error: CLANG_WARNING: libvirt-10.1.0/redhat-linux-build/src/access/viraccessapicheck.c:8480:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 8478| } # 8479| # 8480|-> if ((rv = virAccessManagerCheckNodeDevice(mgr, conn->driver->name, device, VIR_ACCESS_PERM_NODE_DEVICE_GETATTR)) <= 0) { # 8481| virObjectUnref(mgr); # 8482| virResetLastError(); Error: CLANG_WARNING: libvirt-10.1.0/redhat-linux-build/src/access/viraccessapicheck.c:9186:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 9184| } # 9185| # 9186|-> if ((rv = virAccessManagerCheckStorageVol(mgr, conn->driver->name, pool, vol, VIR_ACCESS_PERM_STORAGE_VOL_GETATTR)) <= 0) { # 9187| virObjectUnref(mgr); # 9188| virResetLastError(); Error: CLANG_WARNING: libvirt-10.1.0/redhat-linux-build/src/access/viraccessapicheck.c:9227:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 9225| } # 9226| # 9227|-> if ((rv = virAccessManagerCheckStorageVol(mgr, conn->driver->name, pool, vol, VIR_ACCESS_PERM_STORAGE_VOL_GETATTR)) <= 0) { # 9228| virObjectUnref(mgr); # 9229| virResetLastError(); Error: CLANG_WARNING: libvirt-10.1.0/redhat-linux-build/src/access/viraccessapicheck.c:9352:10: warning[deadcode.DeadStores]: Although the value stored to 'rv' is used in the enclosing expression, the value is never actually read from 'rv' # 9350| } # 9351| # 9352|-> if ((rv = virAccessManagerCheckStorageVol(mgr, conn->driver->name, pool, vol, VIR_ACCESS_PERM_STORAGE_VOL_GETATTR)) <= 0) { # 9353| virObjectUnref(mgr); # 9354| virResetLastError(); Error: CLANG_WARNING: libvirt-10.1.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: CLANG_WARNING: libvirt-10.1.0/src/admin/libvirt-admin.c:40: included_from: Included from here. libvirt-10.1.0/src/admin/admin_remote.c:128: included_from: Included from here. libvirt-10.1.0/redhat-linux-build/src/admin/admin_client.h:95:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'tmp_results' # 93| for (i = 0; i < ret.servers.servers_len; i++) # 94| virObjectUnref(tmp_results[i]); # 95|-> VIR_FREE(tmp_results); # 96| } # 97| Error: CLANG_WARNING: libvirt-10.1.0/src/admin/libvirt-admin.c:40: included_from: Included from here. libvirt-10.1.0/src/admin/admin_remote.c:128: included_from: Included from here. libvirt-10.1.0/redhat-linux-build/src/admin/admin_client.h:241:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'tmp_results' # 239| for (i = 0; i < ret.clients.clients_len; i++) # 240| virObjectUnref(tmp_results[i]); # 241|-> VIR_FREE(tmp_results); # 242| } # 243| Error: CLANG_WARNING: libvirt-10.1.0/src/access/viraccessmanager.c:97:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'privateData' # 95| # 96| if (!(mgr = virObjectLockableNew(virAccessManagerClass))) { # 97|-> VIR_FREE(privateData); # 98| return NULL; # 99| } Error: CLANG_WARNING: libvirt-10.1.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.1.0/src/conf/capabilities.c:772:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'capsdata' # 770| NULL, NULL); # 771| # 772|-> return capsdata != NULL; # 773| } # 774| Error: CLANG_WARNING: libvirt-10.1.0/src/conf/capabilities.c:1507:5: warning[deadcode.DeadStores]: Value stored to 'tmp_size' is never read # 1505| *ndistancesRet = tmp_size; # 1506| *distancesRet = g_steal_pointer(&tmp); # 1507|-> tmp_size = 0; # 1508| # 1509| return 0; Error: CLANG_WARNING: libvirt-10.1.0/src/conf/capabilities.c:1831:13: warning[deadcode.DeadStores]: Although the value stored to 'direrr' is used in the enclosing expression, the value is never actually read from 'direrr' # 1829| return -1; # 1830| # 1831|-> while ((direrr = virDirRead(dir, &entry, path)) > 0) { # 1832| const char *dname = STRSKIP(entry->d_name, "node"); # 1833| unsigned int initNode; Error: CLANG_WARNING: libvirt-10.1.0/src/conf/capabilities.c:1895:20: warning[deadcode.DeadStores]: Although the value stored to 'direrr' is used in the enclosing expression, the value is never actually read from 'direrr' # 1893| return -1; # 1894| # 1895|-> while (dir && (direrr = virDirRead(dir, &entry, path)) > 0) { # 1896| const char *dname = STRSKIP(entry->d_name, "node"); # 1897| unsigned int node; Error: CLANG_WARNING: libvirt-10.1.0/src/conf/capabilities.c:2118:38: warning[core.NullDereference]: Array access (via field 'banks') results in a null pointer dereference # 2116| # 2117| for (i = 0; i < caps->host.cache.nbanks; i++) { # 2118|-> virCapsHostCacheBank *bank = caps->host.cache.banks[i]; # 2119| node = g_new0(virCapsHostMemBWNode, 1); # 2120| Error: CLANG_WARNING: libvirt-10.1.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.1.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.1.0/src/conf/cpu_conf.c:1215:15: warning[deadcode.DeadStores]: Although the value stored to 'doc' is used in the enclosing expression, the value is never actually read from 'doc' # 1213| g_autoptr(xmlXPathContext) ctxt = NULL; # 1214| # 1215|-> if (!(doc = virXMLParseStringCtxt(xmlCPUs[i], _("(CPU_definition)"), &ctxt))) # 1216| goto error; # 1217| Error: CLANG_WARNING: libvirt-10.1.0/src/conf/domain_event.c:2398:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'data' # 2396| _("failed to compile regex '%1$s': %2$s"), # 2397| event, err->message); # 2398|-> VIR_FREE(data); # 2399| return -1; # 2400| } Error: CLANG_WARNING: libvirt-10.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.0/src/conf/virdomaincheckpointobjlist.c:67:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'checkpoints' # 65| checkpoints->base = virDomainMomentObjListNew(); # 66| if (!checkpoints->base) { # 67|-> VIR_FREE(checkpoints); # 68| return NULL; # 69| } Error: CLANG_WARNING: libvirt-10.1.0/src/conf/virdomaincheckpointobjlist.c:238:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'list' # 236| for (i = 0; i < count; i++) # 237| virObjectUnref(list[i]); # 238|-> VIR_FREE(list); # 239| } # 240| return ret; Error: CLANG_WARNING: libvirt-10.1.0/src/conf/virdomainsnapshotobjlist.c:114:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'snapshots' # 112| snapshots->base = virDomainMomentObjListNew(); # 113| if (!snapshots->base) { # 114|-> VIR_FREE(snapshots); # 115| return NULL; # 116| } Error: CLANG_WARNING: libvirt-10.1.0/src/conf/virdomainsnapshotobjlist.c:312:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'list' # 310| for (i = 0; i < count; i++) # 311| virObjectUnref(list[i]); # 312|-> VIR_FREE(list); # 313| } # 314| return ret; Error: CLANG_WARNING: libvirt-10.1.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.1.0/src/conf/virnetworkobj.c:1198:15: warning[deadcode.DeadStores]: Although the value stored to 'checkdef' is used in the enclosing expression, the value is never actually read from 'checkdef' # 1196| * add anything illegal to the def # 1197| */ # 1198|-> if (!(checkdef = virNetworkDefCopy(livedef, xmlopt, 0))) # 1199| return -1; # 1200| } Error: CLANG_WARNING: libvirt-10.1.0/src/conf/virnetworkobj.c:1215:15: warning[deadcode.DeadStores]: Although the value stored to 'checkdef' is used in the enclosing expression, the value is never actually read from 'checkdef' # 1213| return -1; # 1214| } # 1215|-> if (!(checkdef = virNetworkDefCopy(configdef, # 1216| xmlopt, # 1217| VIR_NETWORK_XML_INACTIVE))) { Error: CLANG_WARNING: libvirt-10.1.0/src/conf/virnetworkobj.c:1346:15: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'nets') # 1344| /* trim the array to the final size */ # 1345| VIR_REALLOC_N(data.nets, data.nnets + 1); # 1346|-> *nets = g_steal_pointer(&data.nets); # 1347| } # 1348| Error: CLANG_WARNING: libvirt-10.1.0/src/conf/virnetworkobj.c:1644:13: warning[deadcode.DeadStores]: Although the value stored to 'rc' is used in the enclosing expression, the value is never actually read from 'rc' # 1642| return rc; # 1643| # 1644|-> while ((rc = virDirRead(dh, &de, dir)) > 0) { # 1645| char *file = NULL; # 1646| Error: CLANG_WARNING: libvirt-10.1.0/src/conf/virnetworkobj.c:1730:16: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'ports') # 1728| /* trim the array to the final size */ # 1729| VIR_REALLOC_N(data.ports, data.nports + 1); # 1730|-> *ports = g_steal_pointer(&data.ports); # 1731| } # 1732| Error: CLANG_WARNING: libvirt-10.1.0/src/conf/virnetworkobj.c:1793:13: warning[deadcode.DeadStores]: Although the value stored to 'rc' is used in the enclosing expression, the value is never actually read from 'rc' # 1791| return rc; # 1792| # 1793|-> while ((rc = virDirRead(dh, &de, dir)) > 0) { # 1794| g_autofree char *file = NULL; # 1795| Error: CLANG_WARNING: libvirt-10.1.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.1.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.1.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.1.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.1.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.1.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.1.0/src/conf/virnwfilterobj.c:554:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'tmp_filters' # 552| virObjectUnref(tmp_filters[i]); # 553| } # 554|-> VIR_FREE(tmp_filters); # 555| for (i = 0; i < nfilters; i++) # 556| virNWFilterObjUnlock(objs[i]); Error: CLANG_WARNING: libvirt-10.1.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.1.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.1.0/src/conf/virstorageobj.c: scope_hint: In function ‘virStoragePoolObjSourceMatchTypeDEVICE’ libvirt-10.1.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.1.0/src/conf/virstorageobj.c: scope_hint: In function ‘virStoragePoolObjSourceFindDuplicateCb’ libvirt-10.1.0/src/conf/virstorageobj.c:1397:47: warning[-Wanalyzer-deref-before-check]: check of ‘payload’ for NULL after already dereferencing it libvirt-10.1.0/src/datatypes.h:24: included_from: Included from here. libvirt-10.1.0/src/conf/virstorageobj.c:23: included_from: Included from here. libvirt-10.1.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.1.0/src/conf/virstorageobj.c:1403:47: warning[-Wanalyzer-deref-before-check]: check of ‘payload’ for NULL after already dereferencing it libvirt-10.1.0/src/internal.h:79:29: note: in definition of macro ‘STREQ’ libvirt-10.1.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.1.0/src/conf/virstorageobj.c:1417:55: warning[-Wanalyzer-deref-before-check]: check of ‘payload’ for NULL after already dereferencing it libvirt-10.1.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.1.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.1.0/src/cpu/cpu.c:832:11: warning[deadcode.DeadStores]: Although the value stored to 'xml' is used in the enclosing expression, the value is never actually read from 'xml' # 830| VIR_DEBUG("xmlStr=%s", xmlStr); # 831| # 832|-> if (!(xml = virXMLParseStringCtxt(xmlStr, _("CPU data"), &ctxt))) { # 833| virReportError(VIR_ERR_INTERNAL_ERROR, "%s", # 834| _("cannot parse CPU data")); Error: CLANG_WARNING: libvirt-10.1.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.1.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.1.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.1.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: CLANG_WARNING: libvirt-10.1.0/src/cpu/cpu_x86.c:944:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'vendor' # 942| # 943| if (x86VendorFind(map, vendor->name)) { # 944|-> virReportError(VIR_ERR_INTERNAL_ERROR, # 945| _("CPU vendor %1$s already defined"), vendor->name); # 946| return -1; Error: CLANG_WARNING: libvirt-10.1.0/src/cpu/cpu_x86.c:1144:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'feature' # 1142| # 1143| if (x86FeatureFind(map, feature->name)) { # 1144|-> virReportError(VIR_ERR_INTERNAL_ERROR, # 1145| _("CPU feature %1$s already defined"), feature->name); # 1146| return -1; Error: CLANG_WARNING: libvirt-10.1.0/src/cpu/cpu_x86.c:1367:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'model' # 1365| # 1366| if (!(feature = x86FeatureFind(map, cpu->features[i].name))) { # 1367|-> virReportError(VIR_ERR_INTERNAL_ERROR, # 1368| _("Unknown CPU feature %1$s"), cpu->features[i].name); # 1369| return NULL; Error: CLANG_WARNING: libvirt-10.1.0/src/cpu/cpu_x86.c:1662:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'model' # 1660| # 1661| if (x86ModelParseDecode(model, ctxt) < 0) # 1662|-> return -1; # 1663| # 1664| if (x86ModelParseAncestor(model, ctxt, map) < 0) Error: CLANG_WARNING: libvirt-10.1.0/src/cpu/cpu_x86.c:2857:20: warning[unix.Malloc]: Potential leak of memory pointed to by 'modelNames' # 2855| # 2856| if (!(featData = virCPUDataNew(archs[0]))) # 2857|-> return NULL; # 2858| # 2859| for (i = 0; features[i]; i++) { Error: CLANG_WARNING: libvirt-10.1.0/src/cpu/cpu_x86.c:3199:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'model' # 3197| } # 3198| # 3199|-> virCPUDefFreeModel(cpu); # 3200| # 3201| virCPUDefCopyModel(cpu, expanded, false); Error: GCC_ANALYZER_WARNING (CWE-457): libvirt-10.1.0/src/esx/esx_driver.c: scope_hint: In function ‘esxConnectListAllDomains’ libvirt-10.1.0/src/esx/esx_driver.c:4812:27: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘powerState’ libvirt-10.1.0/src/esx/esx_driver.c:26: included_from: Included from here. libvirt-10.1.0/src/esx/esx_driver.c:4716:5: note: in expansion of macro ‘virCheckFlags’ libvirt-10.1.0/src/esx/esx_driver.c:4737:9: note: in expansion of macro ‘MATCH’ libvirt-10.1.0/src/esx/esx_driver.c:4751:20: note: in expansion of macro ‘MATCH’ libvirt-10.1.0/src/esx/esx_driver.c:4810:13: note: in expansion of macro ‘MATCH’ libvirt-10.1.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.1.0/src/esx/esx_driver.c:4814:27: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘powerState’ libvirt-10.1.0/src/esx/esx_driver.c:4716:5: note: in expansion of macro ‘virCheckFlags’ libvirt-10.1.0/src/esx/esx_driver.c:4737:9: note: in expansion of macro ‘MATCH’ libvirt-10.1.0/src/esx/esx_driver.c:4751:20: note: in expansion of macro ‘MATCH’ libvirt-10.1.0/src/esx/esx_driver.c:4810:13: note: in expansion of macro ‘MATCH’ libvirt-10.1.0/src/esx/esx_driver.c:4811:16: note: in expansion of macro ‘MATCH’ libvirt-10.1.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.1.0/src/esx/esx_driver.c:4866:21: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘powerState’ libvirt-10.1.0/src/esx/esx_driver.c:4716:5: note: in expansion of macro ‘virCheckFlags’ libvirt-10.1.0/src/esx/esx_driver.c:4737:9: note: in expansion of macro ‘MATCH’ libvirt-10.1.0/src/esx/esx_driver.c:4751:20: note: in expansion of macro ‘MATCH’ libvirt-10.1.0/src/esx/esx_driver.c:4810:13: note: in expansion of macro ‘MATCH’ libvirt-10.1.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.1.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.1.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.1.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.1.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.1.0/src/esx/esx_util.c: scope_hint: In function ‘esxUtil_ReplaceSpecialWindowsPathChars’ libvirt-10.1.0/src/esx/esx_util.c:403:12: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘tmp’ libvirt-10.1.0/src/esx/esx_util.c:424:16: note: in expansion of macro ‘g_strdup’ libvirt-10.1.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.1.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.1.0/src/hyperv/hyperv_driver.c: scope_hint: In function ‘hypervDomainAttachFloppy’ libvirt-10.1.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.1.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.1.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.1.0/src/hyperv/hyperv_driver.c: scope_hint: In function ‘hypervDomainAttachStorage’ libvirt-10.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.0/src/hyperv/hyperv_driver.c:1589:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'ndef' # 1587| if (net->data->HostResource.count < 1 || !*switchConnection || # 1588| net->data->EnabledState == MSVM_ETHERNETPORTALLOCATIONSETTINGDATA_ENABLEDSTATE_DISABLED) { # 1589|-> VIR_DEBUG("Adapter not connected to switch"); # 1590| return 0; # 1591| } Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.1.0/src/hyperv/hyperv_driver.c: scope_hint: In function ‘hypervDomainSetMemoryProperty’ libvirt-10.1.0/src/hyperv/hyperv_driver.c:2244: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.1.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.1.0/src/hyperv/hyperv_driver.c: scope_hint: In function ‘hypervDomainSetMemoryProperty’ libvirt-10.1.0/src/hyperv/hyperv_driver.c: scope_hint: In function ‘hypervDomainSetMemoryProperty’ # 2242| { # 2243| char uuid_string[VIR_UUID_STRING_BUFLEN]; # 2244|-> hypervPrivate *priv = domain->conn->privateData; # 2245| g_autoptr(Msvm_VirtualSystemSettingData) vssd = NULL; # 2246| g_autoptr(Msvm_MemorySettingData) memsd = NULL; Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.1.0/src/hyperv/hyperv_driver.c: scope_hint: In function ‘hypervDomainSetVcpusFlags’ libvirt-10.1.0/src/hyperv/hyperv_driver.c:2502: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.1.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.1.0/src/hyperv/hyperv_driver.c: scope_hint: In function ‘hypervDomainSetVcpusFlags’ libvirt-10.1.0/src/hyperv/hyperv_driver.c: scope_hint: In function ‘hypervDomainSetVcpusFlags’ # 2500| { # 2501| char uuid_string[VIR_UUID_STRING_BUFLEN]; # 2502|-> hypervPrivate *priv = domain->conn->privateData; # 2503| g_autoptr(Msvm_VirtualSystemSettingData) vssd = NULL; # 2504| g_autoptr(Msvm_ProcessorSettingData) proc_sd = NULL; Error: CLANG_WARNING: libvirt-10.1.0/src/hyperv/hyperv_driver.c:2777:12: warning[core.NonNullParamChecker]: Null pointer passed to 2nd parameter expecting 'nonnull' # 2775| # 2776| /* XXX xmlopts must be non-NULL */ # 2777|-> return virDomainDefFormat(def, NULL, virDomainDefFormatConvertXMLFlags(flags)); # 2778| } # 2779| Error: CLANG_WARNING: libvirt-10.1.0/src/hyperv/hyperv_driver.c:3603:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'translatedKeycodes' # 3601| # 3602| if (keycode < 0) { # 3603|-> virReportError(VIR_ERR_INTERNAL_ERROR, "%s", # 3604| _("Could not translate keycode")); # 3605| return -1; Error: CLANG_WARNING: libvirt-10.1.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: CLANG_WARNING: libvirt-10.1.0/src/hypervisor/domain_interface.c:442:26: warning[core.NonNullParamChecker]: Null pointer passed to 2nd parameter expecting 'nonnull' # 440| ignore_value(virNetDevMidonetUnbindPort(vport)); # 441| } else if (vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH) { # 442|-> ignore_value(virNetDevOpenvswitchRemovePort( # 443| virDomainNetGetActualBridgeName(net), # 444| net->ifname)); Error: CLANG_WARNING: libvirt-10.1.0/src/interface/interface_backend_udev.c:965:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'ifacedef' # 963| dev = udev_device_new_from_subsystem_sysname(udev, "net", name); # 964| if (!dev) { # 965|-> virReportError(VIR_ERR_NO_INTERFACE, # 966| _("couldn't find interface named '%1$s'"), name); # 967| goto error; Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.1.0/src/interface/interface_backend_udev.c: scope_hint: In function ‘udevGetIfaceDef’ libvirt-10.1.0/src/interface/interface_backend_udev.c:1014:27: warning[-Wanalyzer-null-argument]: use of NULL ‘name’ where non-null expected libvirt-10.1.0/src/util/virlog.h:24: included_from: Included from here. libvirt-10.1.0/src/interface/interface_backend_udev.c:26: included_from: Included from here. libvirt-10.1.0/src/interface/interface_backend_udev.c:1058: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.1.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.1.0/src/internal.h:30: included_from: Included from here. libvirt-10.1.0/src/interface/interface_backend_udev.c:960:22: note: in expansion of macro ‘g_strdup’ libvirt-10.1.0/src/interface/interface_backend_udev.c: scope_hint: In function ‘udevGetIfaceDef’ libvirt-10.1.0/src/interface/interface_backend_udev.c:971:21: note: in expansion of macro ‘g_strdup’ libvirt-10.1.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 # 1012| * to prevent false positives # 1013| */ # 1014|-> vlan_parent_dev = strrchr(name, '.'); # 1015| if (vlan_parent_dev) # 1016| ifacedef->type = VIR_INTERFACE_TYPE_VLAN; Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.1.0/src/util/vircgroupv1.c: scope_hint: In function ‘virCgroupV1DetectPlacement’ libvirt-10.1.0/src/internal.h:79:22: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected libvirt-10.1.0/src/util/vircgroupv1.c:368:26: note: in expansion of macro ‘STREQ’ libvirt-10.1.0/src/util/vircgroupv1.c:355:21: note: in expansion of macro ‘g_strdup’ libvirt-10.1.0/src/util/vircgroupv1.c: scope_hint: In function ‘virCgroupV1DetectPlacement’ libvirt-10.1.0/src/util/vircgroupv1.c:368:26: note: in expansion of macro ‘STREQ’ libvirt-10.1.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.1.0/src/internal.h:81:23: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected libvirt-10.1.0/src/conf/nwfilter_params.c:424:21: note: in expansion of macro ‘STRNEQ’ libvirt-10.1.0/src/conf/nwfilter_params.c:416:13: note: in expansion of macro ‘STREQ’ libvirt-10.1.0/src/conf/nwfilter_params.c:416:13: note: in expansion of macro ‘STREQ’ libvirt-10.1.0/src/conf/nwfilter_params.c:416:13: note: in expansion of macro ‘STREQ’ libvirt-10.1.0/src/conf/nwfilter_params.c:424:21: note: in expansion of macro ‘STRNEQ’ libvirt-10.1.0/src/conf/nwfilter_params.c:424:21: note: in expansion of macro ‘STRNEQ’ libvirt-10.1.0/src/conf/nwfilter_params.c:424:21: note: in expansion of macro ‘STRNEQ’ libvirt-10.1.0/src/conf/nwfilter_params.c:424:21: note: in expansion of macro ‘STRNEQ’ libvirt-10.1.0/src/conf/nwfilter_params.c:424:21: note: in expansion of macro ‘STRNEQ’ libvirt-10.1.0/src/conf/nwfilter_params.c:424:21: note: in expansion of macro ‘STRNEQ’ /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.1.0/src/util/viralloc.h:25: included_from: Included from here. libvirt-10.1.0/tests/testutils.h:23: included_from: Included from here. libvirt-10.1.0/tests/qemudomaincheckpointxml2xmltest.c:11: included_from: Included from here. libvirt-10.1.0/tests/qemudomaincheckpointxml2xmltest.c: scope_hint: In function ‘testCompareXMLToXMLFiles’ libvirt-10.1.0/src/internal.h:81:23: warning[-Wanalyzer-null-argument]: use of NULL ‘outXmlData’ where non-null expected libvirt-10.1.0/tests/qemudomaincheckpointxml2xmltest.c:92:9: note: in expansion of macro ‘STRNEQ’ libvirt-10.1.0/tests/qemudomaincheckpointxml2xmltest.c:92:9: note: in expansion of macro ‘STRNEQ’ libvirt-10.1.0/tests/qemudomaincheckpointxml2xmltest.c:92:9: note: in expansion of macro ‘STRNEQ’ libvirt-10.1.0/tests/qemudomaincheckpointxml2xmltest.c:92:9: note: in expansion of macro ‘STRNEQ’ libvirt-10.1.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.1.0/src/security/security_driver.h:21: included_from: Included from here. libvirt-10.1.0/src/security/security_selinux.c:28: included_from: Included from here. libvirt-10.1.0/src/security/security_selinux.c: scope_hint: In function ‘virSecuritySELinuxSetFilecon’ libvirt-10.1.0/src/internal.h:81:23: warning[-Wanalyzer-null-argument]: use of NULL ‘tcon’ where non-null expected libvirt-10.1.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.1.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.1.0/src/internal.h:30: included_from: Included from here. libvirt-10.1.0/src/security/security_selinux.c:120:18: note: in expansion of macro ‘g_strdup’ libvirt-10.1.0/src/security/security_selinux.c: scope_hint: In function ‘virSecuritySELinuxSetFilecon’ libvirt-10.1.0/src/security/security_selinux.c: scope_hint: In function ‘virSecuritySELinuxSetFilecon’ libvirt-10.1.0/src/security/security_selinux.c:1390:21: note: in expansion of macro ‘STRNEQ’ libvirt-10.1.0/src/security/security_selinux.c:1390:21: note: in expansion of macro ‘STRNEQ’ libvirt-10.1.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.1.0/src/conf/virchrdev.h:24: included_from: Included from here. libvirt-10.1.0/src/conf/virchrdev.c:28: included_from: Included from here. libvirt-10.1.0/src/conf/virchrdev.c: scope_hint: In function ‘virChrdevLockFilePath’ libvirt-10.1.0/src/internal.h:87:26: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected libvirt-10.1.0/src/internal.h:89:24: note: in expansion of macro ‘STRPREFIX’ libvirt-10.1.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.1.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.1.0/src/internal.h:30: included_from: Included from here. libvirt-10.1.0/src/conf/virchrdev.c:74:15: note: in expansion of macro ‘g_strdup’ libvirt-10.1.0/src/conf/virchrdev.c: scope_hint: In function ‘virChrdevLockFilePath’ libvirt-10.1.0/src/internal.h:89:24: note: in expansion of macro ‘STRPREFIX’ libvirt-10.1.0/src/conf/virchrdev.c:77:16: note: in expansion of macro ‘STRSKIP’ libvirt-10.1.0/src/internal.h:89:24: note: in expansion of macro ‘STRPREFIX’ libvirt-10.1.0/src/conf/virchrdev.c:77:16: note: in expansion of macro ‘STRSKIP’ libvirt-10.1.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.1.0/src/util/virenum.h:21: included_from: Included from here. libvirt-10.1.0/src/util/virconf.h:23: included_from: Included from here. libvirt-10.1.0/src/libxl/xen_xl.c:26: included_from: Included from here. libvirt-10.1.0/src/libxl/xen_xl.c: scope_hint: In function ‘xenParseXLChannel’ libvirt-10.1.0/src/internal.h:87:26: warning[-Wanalyzer-null-argument]: use of NULL ‘type’ where non-null expected libvirt-10.1.0/src/libxl/xen_xl.c:993:17: note: in expansion of macro ‘STRPREFIX’ libvirt-10.1.0/src/libxl/xen_xl.c:975:37: note: in expansion of macro ‘STRPREFIX’ libvirt-10.1.0/src/libxl/xen_xl.c:978:37: note: in expansion of macro ‘STRPREFIX’ libvirt-10.1.0/src/libxl/xen_xl.c:993:17: note: in expansion of macro ‘STRPREFIX’ libvirt-10.1.0/src/libxl/xen_xl.c:993:17: note: in expansion of macro ‘STRPREFIX’ libvirt-10.1.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.1.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.1.0/src/esx/esx_util.c:26: included_from: Included from here. libvirt-10.1.0/src/esx/esx_util.c: scope_hint: In function ‘esxUtil_ParseDatastorePath’ libvirt-10.1.0/src/internal.h:87:26: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘saveptr’ libvirt-10.1.0/src/internal.h:89:24: note: in expansion of macro ‘STRPREFIX’ libvirt-10.1.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.1.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.1.0/src/internal.h:30: included_from: Included from here. libvirt-10.1.0/src/esx/esx_util.c:216:27: note: in expansion of macro ‘g_strdup’ libvirt-10.1.0/src/esx/esx_util.c: scope_hint: In function ‘esxUtil_ParseDatastorePath’ libvirt-10.1.0/src/internal.h:89:24: note: in expansion of macro ‘STRPREFIX’ libvirt-10.1.0/src/esx/esx_util.c:219:17: note: in expansion of macro ‘STRSKIP’ libvirt-10.1.0/src/internal.h:89:24: note: in expansion of macro ‘STRPREFIX’ libvirt-10.1.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.1.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.1.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.1.0/src/libxl/libxl_capabilities.c:306:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'cpus' # 304| } # 305| # 306|-> VIR_FREE(cpus); # 307| VIR_FREE(nr_cpus_node); # 308| libxl_cputopology_list_free(cpu_topo, nr_cpus); Error: CLANG_WARNING: libvirt-10.1.0/src/libxl/libxl_capabilities.c:307:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'nr_cpus_node' # 305| # 306| VIR_FREE(cpus); # 307|-> VIR_FREE(nr_cpus_node); # 308| libxl_cputopology_list_free(cpu_topo, nr_cpus); # 309| libxl_numainfo_list_free(numa_info, nr_nodes); Error: CLANG_WARNING: libvirt-10.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.0/src/libxl/libxl_conf.c:937:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'p' # 935| VIR_FREE(p->distances); # 936| } # 937|-> VIR_FREE(vnuma_nodes); # 938| } # 939| Error: CLANG_WARNING: libvirt-10.1.0/src/libxl/libxl_conf.c:1593:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'x_vkbs' # 1591| } # 1592| VIR_FREE(x_vfbs); # 1593|-> VIR_FREE(x_vkbs); # 1594| return -1; # 1595| } Error: CLANG_WARNING: libvirt-10.1.0/src/libxl/libxl_conf.c:2032:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'x_channels' # 2030| for (i = 0; i < nchannels; i++) # 2031| libxl_device_channel_dispose(&x_channels[i]); # 2032|-> VIR_FREE(x_channels); # 2033| return -1; # 2034| } Error: CLANG_WARNING: libvirt-10.1.0/src/libxl/libxl_conf.c:2125:6: warning[unix.Malloc]: Potential leak of memory pointed to by 'x_controllers' # 2123| for (i = 0; i < ncontrollers; i++) # 2124| libxl_device_usbctrl_dispose(&x_controllers[i]); # 2125|-> VIR_FREE(x_controllers); # 2126| return -1; # 2127| } Error: CLANG_WARNING: libvirt-10.1.0/src/libxl/libxl_conf.c:2170:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'x_usbctrls' # 2168| libxl_device_usbctrl_dispose(&x_usbctrls[i]); # 2169| # 2170|-> VIR_FREE(x_usbctrls); # 2171| return -1; # 2172| } Error: CLANG_WARNING: libvirt-10.1.0/src/libxl/libxl_conf.c:2248:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'x_usbdevs' # 2246| libxl_device_usbdev_dispose(&x_usbdevs[i]); # 2247| # 2248|-> VIR_FREE(x_usbdevs); # 2249| return -1; # 2250| } Error: CLANG_WARNING: libvirt-10.1.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.1.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.1.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.1.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.1.0/src/libxl/libxl_driver.c: scope_hint: In function ‘libxlGetDHCPInterfaces’ libvirt-10.1.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.1.0/src/libxl/libxl_logger.c: scope_hint: In function ‘libxlLoggerNew’ libvirt-10.1.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.1.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.1.0/src/libxl/libxl_logger.c: scope_hint: In function ‘libxlLoggerOpenFile’ libvirt-10.1.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.1.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.1.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.1.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.1.0/src/libxl/xen_common.c:1040:17: warning[deadcode.DeadStores]: Although the value stored to 'vlanstr' is used in the enclosing expression, the value is never actually read from 'vlanstr' # 1038| net->virtPortProfile->virtPortType = VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH; # 1039| return 0; # 1040|-> } else if ((vlanstr = strchr(bridge, ':'))) { # 1041| /* 'bridge' string contains a bridge name and one or more vlan trunks */ # 1042| size_t i; Error: CLANG_WARNING: libvirt-10.1.0/src/libxl/xen_common.c:1580:20: warning[unix.Malloc]: Potential leak of memory pointed to by 'address_array' # 1578| address_array[i] = virSocketAddrFormat(&guestIP->ips[i]->address); # 1579| if (!address_array[i]) # 1580|-> return NULL; # 1581| } # 1582| return g_strjoinv(" ", address_array); Error: CLANG_WARNING: libvirt-10.1.0/src/libxl/xen_common.c:2326:12: warning[unix.Malloc]: Potential leak of memory pointed to by 'netVal' # 2324| return -1; # 2325| # 2326|-> return 0; # 2327| } # 2328| Error: CLANG_WARNING: libvirt-10.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.0/src/lxc/lxc_domain.c:366:26: warning[unix.Malloc]: Use of memory allocated with size zero # 364| } # 365| # 366|-> data.st_valid[i] = true; # 367| } # 368| Error: CLANG_WARNING: libvirt-10.1.0/src/lxc/lxc_domain.c:374:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'data.st' # 372| cleanup: # 373| g_clear_pointer(&data.st, g_free); # 374|-> g_clear_pointer(&data.st_valid, g_free); # 375| return ret; # 376| } Error: CLANG_WARNING: libvirt-10.1.0/src/lxc/lxc_domain.c:374:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'data.st_valid' # 372| cleanup: # 373| g_clear_pointer(&data.st, g_free); # 374|-> g_clear_pointer(&data.st_valid, g_free); # 375| return ret; # 376| } Error: CLANG_WARNING: libvirt-10.1.0/src/lxc/lxc_driver.c:408:11: warning[deadcode.DeadStores]: Although the value stored to 'caps' is used in the enclosing expression, the value is never actually read from 'caps' # 406| parse_flags |= VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA; # 407| # 408|-> if (!(caps = virLXCDriverGetCapabilities(driver, false))) # 409| goto cleanup; # 410| Error: CLANG_WARNING: libvirt-10.1.0/src/lxc/lxc_driver.c:1077:11: warning[deadcode.DeadStores]: Although the value stored to 'caps' is used in the enclosing expression, the value is never actually read from 'caps' # 1075| parse_flags |= VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA; # 1076| # 1077|-> if (!(caps = virLXCDriverGetCapabilities(driver, false))) # 1078| goto cleanup; # 1079| Error: CLANG_WARNING: libvirt-10.1.0/src/lxc/lxc_driver.c:1811:11: warning[deadcode.DeadStores]: Although the value stored to 'caps' is used in the enclosing expression, the value is never actually read from 'caps' # 1809| goto cleanup; # 1810| # 1811|-> if (!(caps = virLXCDriverGetCapabilities(driver, false))) # 1812| goto cleanup; # 1813| Error: CLANG_WARNING: libvirt-10.1.0/src/lxc/lxc_driver.c:2099:5: warning[deadcode.DeadStores]: Value stored to 'flags' is never read # 2097| # 2098| /* We don't return strings, and thus trivially support this flag. */ # 2099|-> flags &= ~VIR_TYPED_PARAM_STRING_OKAY; # 2100| # 2101| if (!*nparams) { Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.1.0/src/lxc/lxc_driver.c: scope_hint: In function ‘lxcDomainAttachDeviceConfig’ libvirt-10.1.0/src/lxc/lxc_driver.c:2997:16: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘dev’ libvirt-10.1.0/src/util/virerror.h:24: included_from: Included from here. libvirt-10.1.0/src/lxc/lxc_driver.c:37: included_from: Included from here. libvirt-10.1.0/src/lxc/lxc_driver.c:4421:5: note: in expansion of macro ‘virCheckFlags’ # 2995| virDomainHostdevDef *hostdev; # 2996| # 2997|-> switch (dev->type) { # 2998| case VIR_DOMAIN_DEVICE_DISK: # 2999| disk = dev->data.disk; Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.1.0/src/lxc/lxc_driver.c: scope_hint: In function ‘lxcDomainDetachDeviceConfig’ libvirt-10.1.0/src/lxc/lxc_driver.c:3143:16: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘dev’ libvirt-10.1.0/src/lxc/lxc_driver.c:4584:5: note: in expansion of macro ‘virCheckFlags’ # 3141| int idx; # 3142| # 3143|-> switch (dev->type) { # 3144| case VIR_DOMAIN_DEVICE_DISK: # 3145| disk = dev->data.disk; Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.1.0/src/lxc/lxc_driver.c: scope_hint: In function ‘lxcDomainAttachDeviceLive’ libvirt-10.1.0/src/lxc/lxc_driver.c:3930:16: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘dev’ libvirt-10.1.0/src/lxc/lxc_driver.c:4421:5: note: in expansion of macro ‘virCheckFlags’ # 3928| int ret = -1; # 3929| # 3930|-> switch (dev->type) { # 3931| case VIR_DOMAIN_DEVICE_DISK: # 3932| ret = lxcDomainAttachDeviceDiskLive(driver, vm, dev); Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.1.0/src/lxc/lxc_driver.c: scope_hint: In function ‘lxcDomainDetachDeviceLive’ libvirt-10.1.0/src/lxc/lxc_driver.c:4361:16: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘dev’ libvirt-10.1.0/src/lxc/lxc_driver.c:4584:5: note: in expansion of macro ‘virCheckFlags’ # 4359| int ret = -1; # 4360| # 4361|-> switch (dev->type) { # 4362| case VIR_DOMAIN_DEVICE_DISK: # 4363| ret = lxcDomainDetachDeviceDiskLive(vm, dev); Error: CLANG_WARNING: libvirt-10.1.0/src/lxc/lxc_driver.c:4599:11: warning[deadcode.DeadStores]: Although the value stored to 'caps' is used in the enclosing expression, the value is never actually read from 'caps' # 4597| goto endjob; # 4598| # 4599|-> if (!(caps = virLXCDriverGetCapabilities(driver, false))) # 4600| goto endjob; # 4601| Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.1.0/src/lxc/lxc_fuse.c: scope_hint: In function ‘lxcProcReadMeminfo’ libvirt-10.1.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.1.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.1.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.1.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.1.0/src/lxc/lxc_native.c:747:13: warning[unix.Malloc]: Attempt to free released memory # 745| lxcNetworkParseData *data = networks.parseData[i]; # 746| for (j = 0; j < data->nips; j++) # 747|-> g_free(data->ips[j]); # 748| g_clear_pointer(&data->ips, g_free); # 749| } Error: CLANG_WARNING: libvirt-10.1.0/src/lxc/lxc_process.c:1268:11: warning[deadcode.DeadStores]: Although the value stored to 'caps' is used in the enclosing expression, the value is never actually read from 'caps' # 1266| goto cleanup; # 1267| # 1268|-> if (!(caps = virLXCDriverGetCapabilities(driver, false))) # 1269| goto cleanup; # 1270| Error: CLANG_WARNING: libvirt-10.1.0/src/network/bridge_driver.c:3735:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'lease' # 3733| if (!(ip_tmp = virJSONValueObjectGetString(lease_tmp, "ip-address"))) { # 3734| /* A lease without ip-address makes no sense */ # 3735|-> virReportError(VIR_ERR_INTERNAL_ERROR, "%s", # 3736| _("found lease without ip-address")); # 3737| goto cleanup; Error: CLANG_WARNING: libvirt-10.1.0/src/node_device/node_device_driver.c:1268:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'child' # 1266| * The value is an object describing the properties of the mdev */ # 1267| if (virJSONValueObjectKeysNumber(json) != 1) # 1268|-> return NULL; # 1269| # 1270| uuid = virJSONValueObjectGetKey(json, 0); Error: CLANG_WARNING: libvirt-10.1.0/src/node_device/node_device_driver.c:1902:11: warning[deadcode.DeadStores]: Although the value stored to 'mdevctl' is used in the enclosing expression, the value is never actually read from 'mdevctl' # 1900| size_t i; # 1901| # 1902|-> if (!(mdevctl = virFindFileInPath(MDEVCTL))) { # 1903| VIR_DEBUG(MDEVCTL " not found. Skipping update of mediated devices."); # 1904| return 0; Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.1.0/src/node_device/node_device_driver.c: scope_hint: In function ‘nodeDeviceUpdateMediatedDevices’ libvirt-10.1.0/src/node_device/node_device_driver.c:1920:13: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘defs’ # 1918| # 1919| for (i = 0; i < data.ndefs; i++) # 1920|-> if (nodeDeviceUpdateMediatedDevice(defs[i], true) < 0) # 1921| return -1; # 1922| Error: CLANG_WARNING: libvirt-10.1.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.1.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.1.0/src/nwfilter/nwfilter_dhcpsnoop.c: scope_hint: In function ‘virNWFilterSnoopLeaseFileLoad’ libvirt-10.1.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.1.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.1.0/src/openvz/openvz_conf.c: scope_hint: In function ‘openvzWriteConfigParam’ libvirt-10.1.0/src/openvz/openvz_conf.c:557:10: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(conf_file, "r")’ # 555| temp_file = g_strdup_printf("%s.tmp", conf_file); # 556| # 557|-> fp = fopen(conf_file, "r"); # 558| if (fp == NULL) # 559| goto error; Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.1.0/src/openvz/openvz_conf.c:557:10: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(conf_file, "r")’ # 555| temp_file = g_strdup_printf("%s.tmp", conf_file); # 556| # 557|-> fp = fopen(conf_file, "r"); # 558| if (fp == NULL) # 559| goto error; Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.1.0/src/qemu/qemu_block.c: scope_hint: In function ‘qemuBlockStorageSourceGetISCSIProps’ libvirt-10.1.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.1.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.1.0/src/internal.h:30: included_from: Included from here. libvirt-10.1.0/src/qemu/qemu_block.h:21: included_from: Included from here. libvirt-10.1.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.1.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.1.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.1.0/src/qemu/qemu_block.c:605:14: note: in expansion of macro ‘g_strdup’ libvirt-10.1.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.1.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.1.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.1.0/src/util/virjson.h:278:1: note: in expansion of macro ‘G_DEFINE_AUTOPTR_CLEANUP_FUNC’ libvirt-10.1.0/src/qemu/qemu_block.c:605:14: note: in expansion of macro ‘g_strdup’ libvirt-10.1.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.1.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.1.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.1.0/src/qemu/qemu_blockjob.c: scope_hint: In function ‘qemuBlockJobProcessEventCompletedActiveCommit’ libvirt-10.1.0/src/qemu/qemu_blockjob.c:1160:30: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘baseparent’ libvirt-10.1.0/src/util/virlog.h:88:5: note: in expansion of macro ‘VIR_DEBUG_INT’ libvirt-10.1.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.1.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.1.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.1.0/src/qemu/qemu_firmware.c:326:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'interfaces' # 324| # 325| if ((tmp = qemuFirmwareOSInterfaceTypeFromString(tmpStr)) <= 0) { # 326|-> virReportError(VIR_ERR_INTERNAL_ERROR, # 327| _("unknown interface type: '%1$s'"), # 328| tmpStr); Error: CLANG_WARNING: libvirt-10.1.0/src/qemu/qemu_firmware.c:557:13: warning[unix.Malloc]: Potential leak of memory pointed to by 't' # 555| # 556| if (!(architectureStr = virJSONValueObjectGetString(item, "architecture"))) { # 557|-> virReportError(VIR_ERR_INTERNAL_ERROR, # 558| _("missing 'architecture' in '%1$s'"), # 559| path); Error: CLANG_WARNING: libvirt-10.1.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.1.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.1.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.1.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.1.0/src/qemu/qemu_migration_cookie.c:908:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'grap' # 906| # 907| if (!(graphicstype = virXPathString("string(./graphics/@type)", ctxt))) { # 908|-> virReportError(VIR_ERR_INTERNAL_ERROR, # 909| "%s", _("missing type attribute in migration data")); # 910| return NULL; Error: CLANG_WARNING: libvirt-10.1.0/src/qemu/qemu_migration_cookie.c:951:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'optr' # 949| # 950| if ((n = virXPathNodeSet("./network/interface", ctxt, &interfaces)) < 0) # 951|-> return NULL; # 952| # 953| optr->nnets = n; Error: CLANG_WARNING: libvirt-10.1.0/src/qemu/qemu_migration_cookie.c:1006:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'ret' # 1004| # 1005| if (!(ret->disks[i].target = virXPathString("string(./@target)", ctxt))) { # 1006|-> virReportError(VIR_ERR_INTERNAL_ERROR, "%s", # 1007| _("Malformed disk target")); # 1008| return NULL; Error: CLANG_WARNING: libvirt-10.1.0/src/qemu/qemu_migration_cookie.c:1126:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'caps' # 1124| # 1125| if ((n = virXPathNodeSet("./capabilities[1]/cap", ctxt, &nodes)) < 0) # 1126|-> return NULL; # 1127| # 1128| for (i = 0; i < n; i++) { Error: CLANG_WARNING: libvirt-10.1.0/src/qemu/qemu_migration_cookie.c:1417:11: warning[deadcode.DeadStores]: Although the value stored to 'doc' is used in the enclosing expression, the value is never actually read from 'doc' # 1415| VIR_DEBUG("xml=%s", NULLSTR(xml)); # 1416| # 1417|-> if (!(doc = virXMLParseStringCtxt(xml, _("(qemu_migration_cookie)"), &ctxt))) # 1418| return -1; # 1419| Error: CLANG_WARNING: libvirt-10.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.0/src/qemu/qemu_namespace.c: scope_hint: In function ‘qemuNamespaceUnlinkPaths’ libvirt-10.1.0/src/qemu/qemu_namespace.c:1454:41: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘mount’ libvirt-10.1.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.1.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.1.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.1.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.1.0/src/qemu/qemu_nbdkit.c: scope_hint: In function ‘qemuNbdkitCapsQuery’ libvirt-10.1.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.1.0/src/qemu/qemu_nbdkit.c:21: included_from: Included from here. libvirt-10.1.0/src/qemu/qemu_nbdkit.c:225:18: note: in expansion of macro ‘g_strdup’ libvirt-10.1.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.1.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.1.0/src/qemu/qemu_nbdkit.c: scope_hint: In function ‘qemuNbdkitProcessStart’ libvirt-10.1.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.1.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.1.0/src/qemu/qemu_nbdkit.c:23: included_from: Included from here. /usr/include/libnbd.h:584: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.1.0/src/qemu/qemu_saveimage.c:174:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'zeros' # 172| # 173| if (safewrite(fd, header, sizeof(*header)) != sizeof(*header)) { # 174|-> virReportSystemError(errno, # 175| _("failed to write header to domain save file '%1$s'"), # 176| path); Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.1.0/src/qemu/qemu_snapshot.c: scope_hint: In function ‘qemuSnapshotRevertExternalActive’ libvirt-10.1.0/src/qemu/qemu_snapshot.c:2150:16: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘tmpsnapdef’ libvirt-10.1.0/src/util/virmacaddr.h:23: included_from: Included from here. libvirt-10.1.0/src/util/virebtables.h:24: included_from: Included from here. libvirt-10.1.0/src/qemu/qemu_conf.h:26: included_from: Included from here. libvirt-10.1.0/src/qemu/qemu_snapshot.h:22: included_from: Included from here. libvirt-10.1.0/src/qemu/qemu_snapshot.c:23: included_from: Included from here. libvirt-10.1.0/src/qemu/qemu_snapshot.c:2552:5: note: in expansion of macro ‘virCheckFlags’ libvirt-10.1.0/src/qemu/qemu_snapshot.c: scope_hint: In function ‘qemuSnapshotRevertExternalActive’ libvirt-10.1.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.1.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.1.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.1.0/src/conf/domain_conf.h:3631: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.1.0/src/conf/domain_conf.h:3631: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.1.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.1.0/src/qemu/qemu_validate.c:2763:47: warning[core.NullDereference]: Array access (via field 'queues') results in a null pointer dereference # 2761| bool hasMapping; # 2762| # 2763|-> if (virBitmapGetBit(queueMap, ioth->queues[i], &hasMapping) < 0) { # 2764| virReportError(VIR_ERR_CONFIG_UNSUPPORTED, # 2765| _("disk iothread queue '%1$u' mapping out of range"), Error: CLANG_WARNING: libvirt-10.1.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.1.0/src/qemu/qemu_vhost_user.c:323:24: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘vu’ libvirt-10.1.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.1.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.1.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.1.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.1.0/src/remote/remote_daemon_dispatch.c:4677:14: warning[unix.Malloc]: Potential leak of memory pointed to by 'infiles' # 4675| VIR_FORCE_CLOSE(infiles[i]); # 4676| # 4677|-> for (i = 0; i < noutfiles; i++) # 4678| VIR_FORCE_CLOSE(outfiles[i]); # 4679| Error: CLANG_WARNING: libvirt-10.1.0/src/remote/remote_daemon_dispatch.c:5895:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'files' # 5893| for (i = 0; i < nfiles; i++) # 5894| VIR_FORCE_CLOSE(files[i]); # 5895|-> VIR_FREE(files); # 5896| if (rv < 0) # 5897| virNetMessageSaveError(rerr); Error: CLANG_WARNING: libvirt-10.1.0/src/remote/remote_daemon_dispatch.c:5942:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'files' # 5940| for (i = 0; i < nfiles; i++) # 5941| VIR_FORCE_CLOSE(files[i]); # 5942|-> VIR_FREE(files); # 5943| if (rv < 0) # 5944| virNetMessageSaveError(rerr); Error: CLANG_WARNING: libvirt-10.1.0/src/remote/remote_daemon_stream.c:943:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'buffer' # 941| ret = 0; # 942| cleanup: # 943|-> VIR_FREE(buffer); # 944| virNetMessageFree(msg); # 945| return ret; Error: CLANG_WARNING: libvirt-10.1.0/src/remote/remote_driver.c:724:20: warning[deadcode.DeadStores]: Although the value stored to 'query' is used in the enclosing expression, the value is never actually read from 'query' # 722| } # 723| # 724|-> tmpuri.query = query = virURIFormatParams(uri); # 725| # 726| ret = virURIFormat(&tmpuri); Error: CLANG_WARNING: libvirt-10.1.0/src/remote/remote_driver.c:900:31: warning[core.NullDereference]: Access to field 'server' results in a dereference of a null pointer (loaded from field 'uri') # 898| } # 899| } else { # 900|-> if (inside_daemon && !conn->uri->server) { # 901| mode = REMOTE_DRIVER_MODE_DIRECT; # 902| } else { Error: CLANG_WARNING: libvirt-10.1.0/src/remote/remote_driver.c:951:27: warning[core.NullDereference]: Access to field 'server' results in a dereference of a null pointer (loaded from field 'uri') # 949| # 950| /* Sanity check that nothing requested !direct mode by mistake */ # 951|-> if (inside_daemon && !conn->uri->server && mode != REMOTE_DRIVER_MODE_DIRECT) { # 952| virReportError(VIR_ERR_INVALID_ARG, "%s", # 953| _("Connections from inside daemon must be direct")); Error: CLANG_WARNING: libvirt-10.1.0/src/remote/remote_driver.c:2725:10: warning[deadcode.DeadStores]: Although the value stored to 'eventID' is used in the enclosing expression, the value is never actually read from 'eventID' # 2723| VIR_LOCK_GUARD lock = remoteDriverLock(priv); # 2724| # 2725|-> if ((eventID = virObjectEventStateEventID(conn, priv->eventState, # 2726| callbackID, &remoteID)) < 0) # 2727| return -1; Error: CLANG_WARNING: libvirt-10.1.0/src/remote/remote_driver.c:2806:10: warning[deadcode.DeadStores]: Although the value stored to 'eventID' is used in the enclosing expression, the value is never actually read from 'eventID' # 2804| VIR_LOCK_GUARD lock = remoteDriverLock(priv); # 2805| # 2806|-> if ((eventID = virObjectEventStateEventID(conn, priv->eventState, # 2807| callbackID, &remoteID)) < 0) # 2808| return -1; Error: CLANG_WARNING: libvirt-10.1.0/src/remote/remote_driver.c:2890:10: warning[deadcode.DeadStores]: Although the value stored to 'eventID' is used in the enclosing expression, the value is never actually read from 'eventID' # 2888| VIR_LOCK_GUARD lock = remoteDriverLock(priv); # 2889| # 2890|-> if ((eventID = virObjectEventStateEventID(conn, priv->eventState, # 2891| callbackID, &remoteID)) < 0) # 2892| return -1; Error: CLANG_WARNING: libvirt-10.1.0/src/remote/remote_driver.c:2974:10: warning[deadcode.DeadStores]: Although the value stored to 'eventID' is used in the enclosing expression, the value is never actually read from 'eventID' # 2972| VIR_LOCK_GUARD lock = remoteDriverLock(priv); # 2973| # 2974|-> if ((eventID = virObjectEventStateEventID(conn, priv->eventState, # 2975| callbackID, &remoteID)) < 0) # 2976| return -1; Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.1.0/src/remote/remote_driver.c: scope_hint: In function ‘remoteAuthFillFromConfig’ libvirt-10.1.0/src/remote/remote_driver.c:3461:15: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘state’ libvirt-10.1.0/src/remote/remote_driver.c: scope_hint: In function ‘remoteAuthFillFromConfig’ # 3459| VIR_DEBUG("Trying to fill auth parameters from config file"); # 3460| # 3461|-> if (!state->config) { # 3462| if (virAuthGetConfigFilePath(conn, &path) < 0) # 3463| return -1; Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.1.0/src/remote/remote_driver.c: scope_hint: In function ‘remoteNetworkGetDHCPLeases’ libvirt-10.1.0/src/remote/remote_driver.c:6818:27: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’ /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.1.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.1.0/src/internal.h:30: included_from: Included from here. libvirt-10.1.0/src/rpc/virnettlscontext.h:23: included_from: Included from here. libvirt-10.1.0/src/rpc/virnetclient.h:23: included_from: Included from here. libvirt-10.1.0/src/remote/remote_driver.c:26: included_from: Included from here. /usr/include/glib-2.0/glib/gmem.h:332:57: note: in expansion of macro ‘_G_NEW’ libvirt-10.1.0/src/remote/remote_driver.c:6818:29: note: in expansion of macro ‘g_new0’ # 6816| # 6817| for (i = 0; i < ret.leases.leases_len; i++) { # 6818|-> leases_ret[i] = g_new0(virNetworkDHCPLease, 1); # 6819| # 6820| if (remoteSerializeDHCPLease(leases_ret[i], &ret.leases.leases_val[i]) < 0) Error: CLANG_WARNING: libvirt-10.1.0/src/remote/remote_driver.c:6833:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'leases_ret' # 6831| for (i = 0; i < ret.leases.leases_len; i++) # 6832| virNetworkDHCPLeaseFree(leases_ret[i]); # 6833|-> VIR_FREE(leases_ret); # 6834| } # 6835| Error: CLANG_WARNING: libvirt-10.1.0/src/remote/remote_driver.c:6909:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'elem' # 6907| if (elem) { # 6908| virObjectUnref(elem->dom); # 6909|-> VIR_FREE(elem); # 6910| } # 6911| virDomainStatsRecordListFree(tmpret); Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.1.0/src/remote/remote_driver.c: scope_hint: In function ‘remoteDomainInterfaceAddresses’ libvirt-10.1.0/src/remote/remote_driver.c:7061:23: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’ # 7059| remote_domain_interface *iface_ret = &(ret.ifaces.ifaces_val[i]); # 7060| # 7061|-> ifaces_ret[i] = g_new0(virDomainInterface, 1); # 7062| # 7063| iface = ifaces_ret[i]; Error: CLANG_WARNING: libvirt-10.1.0/src/remote/remote_driver.c:7102:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'ifaces_ret' # 7100| for (i = 0; i < ret.ifaces.ifaces_len; i++) # 7101| virDomainInterfaceFree(ifaces_ret[i]); # 7102|-> VIR_FREE(ifaces_ret); # 7103| } # 7104| return rv; Error: CLANG_WARNING: libvirt-10.1.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.1.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.1.0/src/rpc/virnetsocket.c: scope_hint: In function ‘virNetSocketNewConnectUNIX’ libvirt-10.1.0/src/rpc/virnetsocket.c:754:9: warning[-Wanalyzer-null-argument]: use of NULL ‘lockpath’ where non-null expected libvirt-10.1.0/src/rpc/virnetsocket.c:45: included_from: Included from here. libvirt-10.1.0/src/util/virlog.h:88:5: note: in expansion of macro ‘VIR_DEBUG_INT’ libvirt-10.1.0/src/rpc/virnetsocket.c:248:5: note: in expansion of macro ‘VIR_DEBUG’ libvirt-10.1.0/src/util/virlog.h:81:72: note: in definition of macro ‘VIR_INFO_INT’ libvirt-10.1.0/src/rpc/virnetsocket.c:303:5: note: in expansion of macro ‘PROBE’ libvirt-10.1.0/src/rpc/virnetsocket.c:306:44: note: in expansion of macro ‘NULLSTR’ libvirt-10.1.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.1.0/src/rpc/virnetsocket.c: scope_hint: In function ‘virNetSocketListen’ libvirt-10.1.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.1.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.1.0/src/rpc/virnetsshsession.c: scope_hint: In function ‘virNetSSHKbIntCb’ libvirt-10.1.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.1.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.1.0/src/internal.h:30: included_from: Included from here. libvirt-10.1.0/src/rpc/virnetsshsession.h:23: included_from: Included from here. libvirt-10.1.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.1.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.1.0/src/rpc/virnetsshsession.c:219:29: note: in expansion of macro ‘g_strdup’ libvirt-10.1.0/src/rpc/virnetsshsession.c: scope_hint: In function ‘virNetSSHKbIntCb’ /usr/include/libssh2.h:101: included_from: Included from here. libvirt-10.1.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.1.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.1.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.1.0/src/security/security_manager.c:105:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'privateData' # 103| return mgr; # 104| error: # 105|-> VIR_FREE(privateData); # 106| virObjectUnref(mgr); # 107| return NULL; Error: CLANG_WARNING: libvirt-10.1.0/src/security/security_manager.c:674:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'sec_managers' # 672| if (generated) # 673| virSecurityLabelDefFree(seclabel); # 674|-> VIR_FREE(sec_managers); # 675| return ret; # 676| } Error: CLANG_WARNING: libvirt-10.1.0/src/security/security_manager.c:734:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'sec_managers' # 732| secmodel); # 733| cleanup: # 734|-> VIR_FREE(sec_managers); # 735| return ret; # 736| } Error: CLANG_WARNING: libvirt-10.1.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: CLANG_WARNING: libvirt-10.1.0/src/security/security_manager.c:1403:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'fds' # 1401| for (i = nfds; i > 0; i--) # 1402| VIR_FORCE_CLOSE(fds[i - 1]); # 1403|-> VIR_FREE(fds); # 1404| VIR_FREE(locked_paths); # 1405| return ret; Error: CLANG_WARNING: libvirt-10.1.0/src/security/security_manager.c:1404:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'locked_paths' # 1402| VIR_FORCE_CLOSE(fds[i - 1]); # 1403| VIR_FREE(fds); # 1404|-> VIR_FREE(locked_paths); # 1405| return ret; # 1406| } Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.1.0/src/storage/storage_backend_fs.c: scope_hint: In function ‘virStorageBackendFileSystemIsMounted’ libvirt-10.1.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.1.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.1.0/src/storage/storage_backend_gluster.c:140:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'ret' # 138| error: # 139| virStorageBackendGlusterClose(ret); # 140|-> return NULL; # 141| } # 142| Error: CLANG_WARNING: libvirt-10.1.0/src/storage/storage_backend_gluster.c:375:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'state' # 373| glfs_closedir(dir); # 374| virStorageBackendGlusterClose(state); # 375|-> return ret; # 376| } # 377| Error: CLANG_WARNING: libvirt-10.1.0/src/storage/storage_backend_gluster.c:435:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'state' # 433| cleanup: # 434| virStorageBackendGlusterClose(state); # 435|-> return ret; # 436| } # 437| Error: CLANG_WARNING: libvirt-10.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.0/src/storage/storage_backend_logical.c: scope_hint: In function ‘virStorageBackendLogicalMatchPoolSource’ libvirt-10.1.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.1.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.1.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.1.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.1.0/src/storage/storage_backend_zfs.c: scope_hint: In function ‘virStorageBackendZFSRefreshPool’ libvirt-10.1.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.1.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.1.0/src/internal.h:30: included_from: Included from here. libvirt-10.1.0/src/util/viralloc.h:25: included_from: Included from here. libvirt-10.1.0/src/storage/storage_backend_zfs.c:24: included_from: Included from here. libvirt-10.1.0/src/storage/storage_backend_zfs.c:235:29: note: in expansion of macro ‘g_strdup’ libvirt-10.1.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.1.0/src/storage/storage_driver.c:2191:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'shadowvol' # 2189| cleanup: # 2190| virObjectUnref(newvol); # 2191|-> VIR_FREE(shadowvol); # 2192| virStoragePoolObjEndAPI(&obj); # 2193| virStoragePoolObjEndAPI(&objsrc); Error: CLANG_WARNING: libvirt-10.1.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.1.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.1.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.1.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.1.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: CLANG_WARNING: libvirt-10.1.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.1.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.1.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.1.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.1.0/src/storage_file/storage_source_backingstore.c: scope_hint: In function ‘virStorageSourceParseNBDColonString’ libvirt-10.1.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.1.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.1.0/src/internal.h:30: included_from: Included from here. libvirt-10.1.0/src/storage_file/storage_source_backingstore.c:24: included_from: Included from here. libvirt-10.1.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.1.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.1.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.1.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.1.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.1.0/src/test/test_driver.c:1354:11: warning[deadcode.DeadStores]: Although the value stored to 'doc' is used in the enclosing expression, the value is never actually read from 'doc' # 1352| goto error; # 1353| # 1354|-> if (!(doc = virXMLParse(file, NULL, NULL, "node", &ctxt, NULL, false))) # 1355| goto error; # 1356| Error: CLANG_WARNING: libvirt-10.1.0/src/test/test_driver.c:1417:11: warning[deadcode.DeadStores]: Although the value stored to 'doc' is used in the enclosing expression, the value is never actually read from 'doc' # 1415| goto error; # 1416| # 1417|-> if (!(doc = virXMLParse(NULL, defaultConnXML, _("(test driver)"), # 1418| "node", &ctxt, NULL, false))) # 1419| goto error; Error: CLANG_WARNING: libvirt-10.1.0/src/test/test_driver.c:3708:35: warning[unix.Malloc]: Potential leak of memory pointed to by 'bandwidth' # 3706| if (bandwidth->out) { # 3707| VIR_FREE(net->bandwidth->out); # 3708|-> net->bandwidth->out = g_steal_pointer(&bandwidth->out); # 3709| } else if (outboundSpecified) { # 3710| /* if we got here it means user requested @outbound to be cleared */ Error: CLANG_WARNING: libvirt-10.1.0/src/test/test_driver.c:5336:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'ifaces_ret' # 5334| virDomainInterfaceFree(iface); # 5335| # 5336|-> VIR_FREE(ifaces_ret); # 5337| return ret; # 5338| } Error: CLANG_WARNING: libvirt-10.1.0/src/test/test_driver.c:5357:11: warning[deadcode.DeadStores]: Although the value stored to 'net' is used in the enclosing expression, the value is never actually read from 'net' # 5355| goto error; # 5356| # 5357|-> if (!(net = virDomainNetFind(privdom->def, device))) # 5358| goto error; # 5359| Error: CLANG_WARNING: libvirt-10.1.0/src/test/test_driver.c:9865:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'tmp' # 9863| if (!(tmp->dom = virGetDomain(conn, dom->def->name, # 9864| dom->def->uuid, dom->def->id))) # 9865|-> return -1; # 9866| # 9867| if (virTypedParamListSteal(params, &tmp->params, &tmp->nparams) < 0) Error: CLANG_WARNING: libvirt-10.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.0/src/util/virbitmap.c:538:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'tmp' # 536| # 537| if (virBitmapParseInternal(str, tmp, false) < 0) # 538|-> return NULL; # 539| # 540| return g_steal_pointer(&tmp); Error: CLANG_WARNING: libvirt-10.1.0/src/util/virbitmap.c:555:5: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 553| virBitmap *dst = virBitmapNew(src->nbits); # 554| # 555|-> memcpy(dst->map, src->map, src->map_len * sizeof(src->map[0])); # 556| # 557| return dst; Error: CLANG_WARNING: libvirt-10.1.0/src/util/virbitmap.c:590:12: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'p') # 588| p++; # 589| } # 590|-> *p |= (unsigned long) bytes[i] << (j * CHAR_BIT); # 591| } # 592| Error: CLANG_WARNING: libvirt-10.1.0/src/util/virbitmap.c:1008:52: warning[core.NullDereference]: Array access (via field 'map') results in a null pointer dereference # 1006| unsigned long nibble = g_ascii_xdigit_value(string[len - i - 1]); # 1007| nibble <<= VIR_BITMAP_BIT_OFFSET(i * 4); # 1008|-> bitmap->map[VIR_BITMAP_UNIT_OFFSET(i * 4)] |= nibble; # 1009| } # 1010| Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.1.0/src/util/vircgroup.c: scope_hint: In function ‘virCgroupDetectPlacement’ libvirt-10.1.0/src/util/vircgroup.c:353:15: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(procfile, "r")’ /usr/include/glib-2.0/glib/gstring.h:37: included_from: Included from here. /usr/include/glib-2.0/glib/giochannel.h:36: included_from: Included from here. /usr/include/glib-2.0/glib.h:56: included_from: Included from here. libvirt-10.1.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.1.0/src/internal.h:30: included_from: Included from here. libvirt-10.1.0/src/util/virbitmap.h:24: included_from: Included from here. libvirt-10.1.0/src/util/vircgroup.h:24: included_from: Included from here. libvirt-10.1.0/src/util/vircgrouppriv.h:28: included_from: Included from here. libvirt-10.1.0/src/util/vircgroup.c:36: included_from: Included from here. libvirt-10.1.0/src/util/vircgroup.c:348:20: note: in expansion of macro ‘g_strdup’ libvirt-10.1.0/src/util/vircgroup.c: scope_hint: In function ‘virCgroupDetectPlacement’ # 351| } # 352| # 353|-> mapping = fopen(procfile, "r"); # 354| if (mapping == NULL) { # 355| virReportSystemError(errno, Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.1.0/src/util/vircgroup.c:353:15: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(procfile, "r")’ libvirt-10.1.0/src/util/vircgroup.c:348:20: note: in expansion of macro ‘g_strdup’ libvirt-10.1.0/src/util/vircgroup.c: scope_hint: In function ‘virCgroupDetectPlacement’ # 351| } # 352| # 353|-> mapping = fopen(procfile, "r"); # 354| if (mapping == NULL) { # 355| virReportSystemError(errno, Error: CLANG_WARNING: libvirt-10.1.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.1.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.1.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.1.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.1.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: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.1.0/src/util/vircgroup.c: scope_hint: In function ‘virCgroupKillInternal’ libvirt-10.1.0/src/util/vircgroup.c:2672:20: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(keypath, "r")’ libvirt-10.1.0/src/util/vircgrouppriv.h:29: included_from: Included from here. libvirt-10.1.0/src/util/vircgroup.c:1515:5: note: in expansion of macro ‘VIR_CGROUP_BACKEND_CALL’ libvirt-10.1.0/src/util/vircgroup.c:1515:5: note: in expansion of macro ‘VIR_CGROUP_BACKEND_CALL’ libvirt-10.1.0/src/util/vircgroup.c:1515:5: note: in expansion of macro ‘VIR_CGROUP_BACKEND_CALL’ # 2670| while (!done) { # 2671| done = true; # 2672|-> if (!(fp = fopen(keypath, "r"))) { # 2673| if (errno == ENOENT) { # 2674| VIR_DEBUG("No file %s, assuming done", keypath); Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.1.0/src/util/vircgroup.c:2672:20: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(keypath, "r")’ libvirt-10.1.0/src/util/vircgroup.c:1515:5: note: in expansion of macro ‘VIR_CGROUP_BACKEND_CALL’ libvirt-10.1.0/src/util/vircgroup.c:1515:5: note: in expansion of macro ‘VIR_CGROUP_BACKEND_CALL’ libvirt-10.1.0/src/util/vircgroup.c:1515:5: note: in expansion of macro ‘VIR_CGROUP_BACKEND_CALL’ # 2670| while (!done) { # 2671| done = true; # 2672|-> if (!(fp = fopen(keypath, "r"))) { # 2673| if (errno == ENOENT) { # 2674| VIR_DEBUG("No file %s, assuming done", keypath); Error: CLANG_WARNING: libvirt-10.1.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.1.0/src/util/vircgroupv1.c: scope_hint: In function ‘virCgroupV1ResolveMountLink’ libvirt-10.1.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.1.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.1.0/src/internal.h:30: included_from: Included from here. libvirt-10.1.0/src/util/vircgroupv1.c:30: included_from: Included from here. libvirt-10.1.0/src/util/vircgroupv1.c:228:11: note: in expansion of macro ‘g_strdup’ libvirt-10.1.0/src/util/vircgroupv1.c: scope_hint: In function ‘virCgroupV1ResolveMountLink’ libvirt-10.1.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.1.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.1.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.1.0/src/util/vircommand.c:2106:19: warning[deadcode.DeadStores]: Although the value stored to 'basename' is used in the enclosing expression, the value is never actually read from 'basename' # 2104| # 2105| if (stripCommandPath) # 2106|-> command = basename = g_path_get_basename(command); # 2107| # 2108| virBufferEscapeShell(buf, command); Error: CLANG_WARNING: libvirt-10.1.0/src/util/vircommand.c:2360:11: warning[unix.Malloc]: Potential leak of memory pointed to by 'fds' # 2358| } # 2359| # 2360|-> ret = 0; # 2361| cleanup: # 2362| if (cmd->outbuf && *cmd->outbuf) Error: CLANG_WARNING: libvirt-10.1.0/src/util/vircommand.c:3288:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'reg' # 3286| for (j = 0; j < i; j++) # 3287| g_regex_unref(reg[j]); # 3288|-> VIR_FREE(reg); # 3289| return -1; # 3290| } Error: CLANG_WARNING: libvirt-10.1.0/src/util/vircommand.c:3345:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'groups' # 3343| for (j = 0; j < totgroups; j++) # 3344| VIR_FREE(groups[j]); # 3345|-> VIR_FREE(groups); # 3346| } # 3347| Error: CLANG_WARNING: libvirt-10.1.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.1.0/src/util/virdaemon.c: scope_hint: In function ‘virDaemonForkIntoBackground’ libvirt-10.1.0/src/util/virdaemon.c:66:16: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(stdinfd, 0)’ libvirt-10.1.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.1.0/src/util/virdaemon.c:68:16: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(stdoutfd, 1)’ libvirt-10.1.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.1.0/src/util/virdaemon.c:70:16: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(stdoutfd, 2)’ libvirt-10.1.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.1.0/src/util/virdevmapper.c:102:20: warning[unix.Malloc]: Potential leak of memory pointed to by '__p' # 100| *buf = g_new0(char, bufsize); # 101| # 102|-> dm->version[0] = DM_VERSION_MAJOR; # 103| dm->version[1] = 0; # 104| dm->version[2] = 0; Error: CLANG_WARNING: libvirt-10.1.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.1.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.1.0/src/util/virdnsmasq.c: scope_hint: In function ‘addnhostsWrite’ libvirt-10.1.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.1.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.1.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.1.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.1.0/src/util/virdnsmasq.c: scope_hint: In function ‘hostsfileWrite’ libvirt-10.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.0/src/util/virfdstream.c: scope_hint: In function ‘virFDStreamOpenFileInternal’ libvirt-10.1.0/src/util/virfdstream.c:1341:9: warning[-Wanalyzer-null-argument]: use of NULL ‘path’ where non-null expected libvirt-10.1.0/src/util/virfdstream.c: scope_hint: In function ‘virFDStreamOpenFileInternal’ libvirt-10.1.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.1.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.1.0/src/internal.h:30: included_from: Included from here. libvirt-10.1.0/src/util/virfdstream.h:24: included_from: Included from here. libvirt-10.1.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.1.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.1.0/src/util/virfdstream.c:1325:37: note: in expansion of macro ‘g_strdup’ libvirt-10.1.0/src/util/virfdstream.c: scope_hint: In function ‘virFDStreamOpenFileInternal’ libvirt-10.1.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.1.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.1.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.1.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.1.0/src/util/virfile.c: scope_hint: In function ‘virFileMakeParentPath’ libvirt-10.1.0/src/util/virfile.c:3234: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.1.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.1.0/src/internal.h:30: included_from: Included from here. libvirt-10.1.0/src/util/virfile.c:26: included_from: Included from here. libvirt-10.1.0/src/util/virfile.c:3232:11: note: in expansion of macro ‘g_strdup’ libvirt-10.1.0/src/util/virfile.c: scope_hint: In function ‘virFileMakeParentPath’ libvirt-10.1.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 # 3232| tmp = g_strdup(path); # 3233| # 3234|-> if ((p = strrchr(tmp, '/')) == NULL) { # 3235| errno = EINVAL; # 3236| return -1; Error: CLANG_WARNING: libvirt-10.1.0/src/util/virfile.c:3321:21: warning[unix.Malloc]: Potential leak of memory pointed to by 'name' # 3319| } # 3320| if (rc != 0) { # 3321|-> errno = rc; # 3322| goto cleanup; # 3323| } Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.1.0/src/util/virfile.c: scope_hint: In function ‘virFileSanitizePath’ libvirt-10.1.0/src/util/virfile.c:3361:16: warning[-Wanalyzer-null-argument]: use of NULL ‘path’ where non-null expected libvirt-10.1.0/src/util/virfile.c:3357:17: note: in expansion of macro ‘g_strdup’ libvirt-10.1.0/src/util/virfile.c: scope_hint: In function ‘virFileSanitizePath’ <built-in>: note: argument 1 of ‘__builtin_strstr’ must be non-null # 3359| /* don't sanitize URIs - rfc3986 states that two slashes may lead to a # 3360| * different resource, thus removing them would possibly change the path */ # 3361|-> if ((uri = strstr(path, "://")) && strchr(path, '/') > uri) # 3362| return cleanpath; # 3363| Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.1.0/src/util/virfile.c: scope_hint: In function ‘virFileIsSharedFSType’ libvirt-10.1.0/src/util/virfile.c:3577:18: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected libvirt-10.1.0/src/util/virfile.c:3575:15: note: in expansion of macro ‘g_strdup’ libvirt-10.1.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.1.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 # 3575| dirpath = g_strdup(path); # 3576| # 3577|-> statfs_ret = statfs(dirpath, &sb); # 3578| # 3579| while ((statfs_ret < 0) && (p != dirpath)) { Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.1.0/src/util/virfile.c: scope_hint: In function ‘virFileGetHugepageSize’ libvirt-10.1.0/src/util/virfile.c:3634:9: warning[-Wanalyzer-null-argument]: use of NULL ‘path’ where non-null expected libvirt-10.1.0/src/internal.h:81:30: note: in definition of macro ‘STRNEQ’ libvirt-10.1.0/src/util/virfile.c:3720:24: note: in expansion of macro ‘g_strdup’ libvirt-10.1.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 # 3632| struct statfs fs; # 3633| # 3634|-> if (statfs(path, &fs) < 0) { # 3635| virReportSystemError(errno, # 3636| _("cannot determine filesystem for '%1$s'"), Error: CLANG_WARNING: libvirt-10.1.0/src/util/virhostcpu.c:451:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'cores_maps' # 449| for (i = 0; i < sock_max; i++) # 450| virBitmapFree(cores_maps[i]); # 451|-> VIR_FREE(cores_maps); # 452| # 453| return ret; Error: CLANG_WARNING: libvirt-10.1.0/src/util/virhostcpu.c:1317:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'msr' # 1315| # 1316| if ((fd = open(KVM_DEVICE, O_RDONLY)) < 0) { # 1317|-> virReportSystemError(errno, _("Unable to open %1$s"), KVM_DEVICE); # 1318| return -1; # 1319| } Error: CLANG_WARNING: libvirt-10.1.0/src/util/virhostcpu.c:1467:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'kvm_cpuid' # 1465| # 1466| /* enlarge the buffer and try again */ # 1467|-> if (errno == E2BIG) { # 1468| VIR_DEBUG("looping %zu", alloc_size); # 1469| continue; Error: CLANG_WARNING: libvirt-10.1.0/src/util/virhostcpu.c:1497:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'info' # 1495| # 1496| if ((kvmFd = open(KVM_DEVICE, O_RDONLY)) < 0) { # 1497|-> virReportSystemError(errno, _("Unable to open %1$s"), KVM_DEVICE); # 1498| return NULL; # 1499| } Error: CLANG_WARNING: libvirt-10.1.0/src/util/virhostcpu.c:1581:16: warning[unix.Malloc]: Potential leak of memory pointed to by 'line' # 1579| # 1580| if (!ARCH_IS_X86(arch) && !ARCH_IS_PPC64(arch) && !ARCH_IS_S390(arch)) # 1581|-> return 0; # 1582| # 1583| while (fgets(line, lineLen, cpuinfo)) { Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.1.0/src/util/virhostmem.c: scope_hint: In function ‘virHostMemGetStats’ libvirt-10.1.0/src/util/virhostmem.c:286:19: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(meminfo_path, "r")’ libvirt-10.1.0/src/util/virhostmem.h:24: included_from: Included from here. libvirt-10.1.0/src/util/virhostmem.c:39: included_from: Included from here. libvirt-10.1.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.1.0/src/util/virhostmem.c:286:19: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(meminfo_path, "r")’ libvirt-10.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.0/src/util/virlockspace.c: scope_hint: In function ‘virLockSpaceResourceFree’ libvirt-10.1.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.1.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.1.0/src/internal.h:30: included_from: Included from here. libvirt-10.1.0/src/util/virlockspace.h:24: included_from: Included from here. libvirt-10.1.0/src/util/virlockspace.c:24: included_from: Included from here. libvirt-10.1.0/src/util/virlockspace.c:124:17: note: in expansion of macro ‘g_strdup’ libvirt-10.1.0/src/util/virlockspace.c: scope_hint: In function ‘virLockSpaceResourceFree’ libvirt-10.1.0/src/util/virlockspace.c:69:15: note: in expansion of macro ‘g_strdup’ libvirt-10.1.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.1.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.1.0/src/util/virmdev.c: scope_hint: In function ‘virMediatedDeviceIsUsed’ libvirt-10.1.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.1.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.1.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.1.0/src/util/virnetdevopenvswitch.c:553:11: warning[deadcode.DeadStores]: Although the value stored to 'absoluteOvsVsctlPath' is used in the enclosing expression, the value is never actually read from 'absoluteOvsVsctlPath' # 551| int status; # 552| # 553|-> if (!(absoluteOvsVsctlPath = virFindFileInPath(OVS_VSCTL))) { # 554| /* If there is no 'ovs-vsctl' then the interface is # 555| * probably not an OpenVSwitch interface and the @path to Error: CLANG_WARNING: libvirt-10.1.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.1.0/src/util/virobject.c: scope_hint: In function ‘virClassIsDerivedFrom’ libvirt-10.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.0/src/util/virpcivpd.c: scope_hint: In function ‘virPCIVPDResourceIsValidTextValue’ libvirt-10.1.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.1.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.1.0/src/internal.h:30: included_from: Included from here. libvirt-10.1.0/src/util/virthread.h:24: included_from: Included from here. libvirt-10.1.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.1.0/src/util/virpcivpd.c:585:25: note: in expansion of macro ‘g_strstrip’ libvirt-10.1.0/src/util/virpcivpd.c:585:16: note: in expansion of macro ‘g_strdup’ libvirt-10.1.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.1.0/src/util/virpcivpd.c:547:10: warning[unix.Malloc]: Potential leak of memory pointed to by 'buf' # 545| /* May have exited the loop prematurely in case RV or RW were encountered and # 546| * they were not the last fields in the section. */ # 547|-> if ((fieldPos < resPos + resDataLen)) { # 548| /* unparsed data still present */ # 549| virReportError(VIR_ERR_OPERATION_FAILED, "%s", Error: CLANG_WARNING: libvirt-10.1.0/src/util/virpcivpd.c:626:20: warning[unix.Malloc]: Potential leak of memory pointed to by 'res' # 624| /* Read the resource data type tag. */ # 625| if (virPCIVPDReadVPDBytes(vpdFileFd, &tag, 1, resPos, &csum) < 0) # 626|-> return NULL; # 627| # 628| /* 0x80 == 0b10000000 - the large resource data type flag. */ Error: CLANG_WARNING: libvirt-10.1.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.1.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.1.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.1.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.1.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.1.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.1.0/src/util/virrotatingfile.c: scope_hint: In function ‘virRotatingFileWriterDelete’ libvirt-10.1.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.1.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.1.0/src/internal.h:30: included_from: Included from here. libvirt-10.1.0/src/util/virrotatingfile.h:24: included_from: Included from here. libvirt-10.1.0/src/util/virrotatingfile.c:28: included_from: Included from here. libvirt-10.1.0/src/util/virrotatingfile.c:239:22: note: in expansion of macro ‘g_strdup’ libvirt-10.1.0/src/util/virrotatingfile.c: scope_hint: In function ‘virRotatingFileWriterDelete’ libvirt-10.1.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.1.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.1.0/src/util/virsocketaddr.c: scope_hint: In function ‘virSocketAddrGetRange’ libvirt-10.1.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.1.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.1.0/src/internal.h:30: included_from: Included from here. libvirt-10.1.0/src/util/virsocket.h:21: included_from: Included from here. libvirt-10.1.0/src/util/virsocketaddr.h:21: included_from: Included from here. libvirt-10.1.0/src/util/virsocketaddr.c:21: included_from: Included from here. libvirt-10.1.0/src/util/virsocketaddr.c:491:23: note: in expansion of macro ‘g_strdup’ libvirt-10.1.0/src/util/virsocketaddr.c: scope_hint: In function ‘virSocketAddrGetRange’ libvirt-10.1.0/src/util/virsocketaddr.c:491:23: note: in expansion of macro ‘g_strdup’ libvirt-10.1.0/src/util/virsocketaddr.c: scope_hint: In function ‘virSocketAddrGetRange’ libvirt-10.1.0/src/util/virsocketaddr.c:898:9: note: in expansion of macro ‘VIR_SOCKET_ADDR_FAMILY’ libvirt-10.1.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.1.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.1.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.1.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.1.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.1.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.1.0/src/libxl/libxl_logger.c:29: included_from: Included from here. libvirt-10.1.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.1.0/src/util/virthread.h:232:5: note: in expansion of macro ‘VIR_WITH_MUTEX_LOCK_GUARD_’ libvirt-10.1.0/src/libxl/libxl_logger.c:198:5: note: in expansion of macro ‘VIR_WITH_MUTEX_LOCK_GUARD’ libvirt-10.1.0/src/util/virthread.h:232:5: note: in expansion of macro ‘VIR_WITH_MUTEX_LOCK_GUARD_’ libvirt-10.1.0/src/libxl/libxl_logger.c:198:5: note: in expansion of macro ‘VIR_WITH_MUTEX_LOCK_GUARD’ libvirt-10.1.0/src/util/virthread.h:232:5: note: in expansion of macro ‘VIR_WITH_MUTEX_LOCK_GUARD_’ libvirt-10.1.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.1.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.1.0/src/util/virthread.h:232:5: note: in expansion of macro ‘VIR_WITH_MUTEX_LOCK_GUARD_’ libvirt-10.1.0/src/libxl/libxl_logger.c:198:5: note: in expansion of macro ‘VIR_WITH_MUTEX_LOCK_GUARD’ libvirt-10.1.0/src/util/virthread.h:232:5: note: in expansion of macro ‘VIR_WITH_MUTEX_LOCK_GUARD_’ libvirt-10.1.0/src/libxl/libxl_logger.c:198:5: note: in expansion of macro ‘VIR_WITH_MUTEX_LOCK_GUARD’ libvirt-10.1.0/src/util/virthread.h:232:5: note: in expansion of macro ‘VIR_WITH_MUTEX_LOCK_GUARD_’ libvirt-10.1.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: CLANG_WARNING: libvirt-10.1.0/src/util/virtypedparam.c:465:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'filtered' # 463| } # 464| # 465|-> VIR_FREE(filtered); # 466| return n; # 467| Error: CLANG_WARNING: libvirt-10.1.0/src/util/virutil.c:612:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'strbuf' # 610| VIR_FREE(*shell); # 611| } # 612|-> VIR_FREE(strbuf); # 613| return ret; # 614| } Error: CLANG_WARNING: libvirt-10.1.0/src/util/virutil.c:653:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'strbuf' # 651| } # 652| # 653|-> VIR_FREE(strbuf); # 654| return NULL; # 655| } Error: CLANG_WARNING: libvirt-10.1.0/src/util/virutil.c:736:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'strbuf' # 734| # 735| cleanup: # 736|-> VIR_FREE(strbuf); # 737| # 738| return ret; Error: CLANG_WARNING: libvirt-10.1.0/src/util/virutil.c:816:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'strbuf' # 814| # 815| cleanup: # 816|-> VIR_FREE(strbuf); # 817| # 818| return ret; Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.1.0/src/util/virutil.c: scope_hint: In function ‘virParseOwnershipIds’ libvirt-10.1.0/src/util/virutil.c:1383:11: warning[-Wanalyzer-null-argument]: use of NULL ‘tmp_label’ where non-null expected /usr/include/glib-2.0/glib/gstring.h:37: included_from: Included from here. /usr/include/glib-2.0/glib/giochannel.h:36: included_from: Included from here. /usr/include/glib-2.0/glib.h:56: included_from: Included from here. libvirt-10.1.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.1.0/src/internal.h:30: included_from: Included from here. libvirt-10.1.0/src/util/virerror.h:24: included_from: Included from here. libvirt-10.1.0/src/util/virutil.c:49: included_from: Included from here. libvirt-10.1.0/src/util/virutil.c:1380:17: note: in expansion of macro ‘g_strdup’ libvirt-10.1.0/src/util/virutil.c: scope_hint: In function ‘virParseOwnershipIds’ <built-in>: note: argument 1 of ‘__builtin_strchr’ must be non-null # 1381| # 1382| /* Split label */ # 1383|-> sep = strchr(tmp_label, ':'); # 1384| if (sep == NULL) { # 1385| virReportError(VIR_ERR_INVALID_ARG, Error: CLANG_WARNING: libvirt-10.1.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.1.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: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.1.0/src/vmware/vmware_conf.c: scope_hint: In function ‘vmwareExtractPid’ libvirt-10.1.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.1.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: CLANG_WARNING: libvirt-10.1.0/src/vmx/vmx.c:1300:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'autodetectedModels' # 1298| # 1299| cleanup: # 1300|-> VIR_FREE(autodetectedModels); # 1301| # 1302| return result; Error: CLANG_WARNING: libvirt-10.1.0/src/vmx/vmx.c:3660:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'preliminaryDisplayName' # 3658| # 3659| cleanup: # 3660|-> VIR_FREE(preliminaryDisplayName); # 3661| VIR_FREE(displayName); # 3662| VIR_FREE(annotation); Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.1.0/tests/commandhelper.c: scope_hint: In function ‘main’ libvirt-10.1.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.1.0/tests/commandhelper.c:73:5: warning[-Wanalyzer-null-argument]: use of NULL ‘fopen("/builddir/build/BUILD/libvirt-10.1.0/redhat-linux-build/tests/commandhelper.log", "w")’ where non-null expected libvirt-10.1.0/tests/commandhelper.c: scope_hint: In function ‘main’ /usr/include/stdio.h: scope_hint: In function ‘main’ /usr/include/stdio.h:184:12: note: argument 1 of ‘fclose’ must be non-null # 71| { # 72| FILE *file = *ptr; # 73|-> fclose(file); # 74| } # 75| Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.1.0/tests/commandhelper.c:73:5: warning[-Wanalyzer-null-argument]: use of NULL ‘log’ where non-null expected libvirt-10.1.0/tests/commandhelper.c: scope_hint: In function ‘main’ libvirt-10.1.0/src/internal.h:27: included_from: Included from here. libvirt-10.1.0/src/util/viralloc.h:25: included_from: Included from here. libvirt-10.1.0/tests/testutils.h:23: included_from: Included from here. libvirt-10.1.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.1.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.1.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.1.0/tests/commandhelper.c: scope_hint: In function ‘parseArguments’ libvirt-10.1.0/tests/commandhelper.c:101:27: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’ libvirt-10.1.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.1.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.1.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.1.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.1.0/tests/commandhelper.c: scope_hint: In function ‘main’ libvirt-10.1.0/tests/commandhelper.c:350:17: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen("/builddir/build/BUILD/libvirt-10.1.0/redhat-linux-build/tests/commandhelper.log", "w")’ # 348| cleanup(FILE *, cleanupFile) log = NULL; # 349| # 350|-> if (!(log = fopen(abs_builddir "/commandhelper.log", "w"))) # 351| return EXIT_FAILURE; # 352| Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.1.0/tests/commandhelper.c:350:17: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen("/builddir/build/BUILD/libvirt-10.1.0/redhat-linux-build/tests/commandhelper.log", "w")’ # 348| cleanup(FILE *, cleanupFile) log = NULL; # 349| # 350|-> if (!(log = fopen(abs_builddir "/commandhelper.log", "w"))) # 351| return EXIT_FAILURE; # 352| Error: CLANG_WARNING: libvirt-10.1.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.1.0/tests/commandtest.c: scope_hint: In function ‘mymain’ libvirt-10.1.0/tests/commandtest.c:1262:48: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(__open_alias("/dev/null", 0), 3)’ # 1260| * want by overwriting any externally inherited fds, then # 1261| * initialize, then clear the slots for testing. */ # 1262|-> if ((fd = open("/dev/null", O_RDONLY)) < 0 || # 1263| dup2(fd, 3) < 0 || # 1264| dup2(fd, 4) < 0 || Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.1.0/tests/commandtest.c:1263:25: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(fd, 4)’ # 1261| * initialize, then clear the slots for testing. */ # 1262| if ((fd = open("/dev/null", O_RDONLY)) < 0 || # 1263|-> dup2(fd, 3) < 0 || # 1264| dup2(fd, 4) < 0 || # 1265| dup2(fd, 5) < 0 || Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.1.0/tests/commandtest.c:1264:25: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(fd, 5)’ # 1262| if ((fd = open("/dev/null", O_RDONLY)) < 0 || # 1263| dup2(fd, 3) < 0 || # 1264|-> dup2(fd, 4) < 0 || # 1265| dup2(fd, 5) < 0 || # 1266| dup2(fd, 6) < 0 || Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.1.0/tests/commandtest.c:1265:25: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(fd, 6)’ # 1263| dup2(fd, 3) < 0 || # 1264| dup2(fd, 4) < 0 || # 1265|-> dup2(fd, 5) < 0 || # 1266| dup2(fd, 6) < 0 || # 1267| dup2(fd, 7) < 0 || Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.1.0/tests/commandtest.c:1266:25: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(fd, 7)’ # 1264| dup2(fd, 4) < 0 || # 1265| dup2(fd, 5) < 0 || # 1266|-> dup2(fd, 6) < 0 || # 1267| dup2(fd, 7) < 0 || # 1268| dup2(fd, 8) < 0 || Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.1.0/tests/commandtest.c:1267:25: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(fd, 8)’ # 1265| dup2(fd, 5) < 0 || # 1266| dup2(fd, 6) < 0 || # 1267|-> dup2(fd, 7) < 0 || # 1268| dup2(fd, 8) < 0 || # 1269| (fd > 8 && VIR_CLOSE(fd) < 0)) { Error: CLANG_WARNING: libvirt-10.1.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.1.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.1.0/tests/fchosttest.c:212: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' # 210| return -1; # 211| # 212|-> if ((fabric_wwn = virVHBAGetConfig(TEST_FC_HOST_PREFIX, # 213| TEST_FC_HOST_NUM_NO_FAB, # 214| "fabric_name"))) Error: CLANG_WARNING: libvirt-10.1.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.1.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.1.0/tests/networkxml2firewalltest.c:104:14: warning[deadcode.DeadStores]: Although the value stored to 'actualargv' is used in the enclosing expression, the value is never actually read from 'actualargv' # 102| return -1; # 103| # 104|-> actual = actualargv = virBufferContentAndReset(&buf); # 105| # 106| /* The first network to be created populates the Error: CLANG_WARNING: libvirt-10.1.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.1.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.1.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.1.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: GCC_ANALYZER_WARNING (CWE-404): libvirt-10.1.0/tests/qemunbdkittest.c: scope_hint: In function ‘testInfoSetArgs’ libvirt-10.1.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.1.0/tests/securityselinuxlabeltest.c: scope_hint: In function ‘testSELinuxLoadFileList’ libvirt-10.1.0/tests/securityselinuxlabeltest.c:107:16: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(g_strdup_printf("%s/securityselinuxlabeldata/%s.txt", "/builddir/build/BUILD/libvirt-10.1.0/tests", testname), "r")’ # 105| testname); # 106| # 107|-> if (!(fp = fopen(path, "r"))) # 108| return -1; # 109| Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.1.0/tests/securityselinuxlabeltest.c:107:16: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(g_strdup_printf("%s/securityselinuxlabeldata/%s.txt", "/builddir/build/BUILD/libvirt-10.1.0/tests", testname), "r")’ # 105| testname); # 106| # 107|-> if (!(fp = fopen(path, "r"))) # 108| return -1; # 109| Error: CLANG_WARNING: libvirt-10.1.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: CLANG_WARNING: libvirt-10.1.0/tests/testutils.c:841:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'preloads' # 839| while ((lib = va_arg(ap, const char *))) { # 840| if (!virFileIsExecutable(lib)) { # 841|-> perror(lib); # 842| va_end(ap); # 843| return EXIT_FAILURE; Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.1.0/tests/testutilsqemu.c: scope_hint: In function ‘testQemuInfoSetArgs’ libvirt-10.1.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.1.0/tests/testutilsqemu.c: scope_hint: In function ‘testQemuGetRealCapsInternal’ libvirt-10.1.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.1.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.1.0/src/internal.h:30: included_from: Included from here. libvirt-10.1.0/src/conf/capabilities.h:24: included_from: Included from here. libvirt-10.1.0/tests/testutilsqemu.h:21: included_from: Included from here. libvirt-10.1.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.1.0/tests/testutilsqemu.c:777:20: note: in expansion of macro ‘g_strdup’ libvirt-10.1.0/tests/testutilsqemu.c: scope_hint: In function ‘testQemuGetRealCapsInternal’ libvirt-10.1.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.1.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.1.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.1.0/tests/vircgrouptest.c:756:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'params' # 754| # 755| cleanup: # 756|-> VIR_FREE(params); # 757| return ret; # 758| } Error: CLANG_WARNING: libvirt-10.1.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.1.0/tests/virhostcputest.c: scope_hint: In function ‘linuxTestCompareFiles’ libvirt-10.1.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.1.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.1.0/tests/virhostcputest.c: scope_hint: In function ‘linuxCPUStatsCompareFiles’ libvirt-10.1.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.1.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.1.0/tests/virhostcputest.c: scope_hint: In function ‘hostCPUSignature’ libvirt-10.1.0/tests/virhostcputest.c:193:15: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(g_strdup_printf("%s/virhostcpudata/linux-%s-%s.cpuinfo", "/builddir/build/BUILD/libvirt-10.1.0/tests", virArchToString(*(const struct linuxTestHostCPUData *)opaque.arch), *(const struct linuxTestHostCPUData *)opaque.testName), "r")’ # 191| abs_srcdir, arch, data->testName); # 192| # 193|-> if (!(f = fopen(cpuinfo, "r"))) { # 194| virReportSystemError(errno, # 195| "Failed to open cpuinfo file '%s'", cpuinfo); Error: GCC_ANALYZER_WARNING (CWE-401): libvirt-10.1.0/tests/virhostcputest.c:193:15: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(g_strdup_printf("%s/virhostcpudata/linux-%s-%s.cpuinfo", "/builddir/build/BUILD/libvirt-10.1.0/tests", virArchToString(*(const struct linuxTestHostCPUData *)opaque.arch), *(const struct linuxTestHostCPUData *)opaque.testName), "r")’ # 191| abs_srcdir, arch, data->testName); # 192| # 193|-> if (!(f = fopen(cpuinfo, "r"))) { # 194| virReportSystemError(errno, # 195| "Failed to open cpuinfo file '%s'", cpuinfo); Error: GCC_ANALYZER_WARNING (CWE-775): libvirt-10.1.0/tests/virnetdaemontest.c: scope_hint: In function ‘testExecRestart’ libvirt-10.1.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.1.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.1.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.1.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.1.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.1.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.1.0/tests/virnetmessagetest.c:281:5: warning[unix.Malloc]: Potential leak of memory pointed to by '_pp.in' # 279| VIR_FREE(err.str1); # 280| VIR_FREE(err.str2); # 281|-> VIR_FREE(err.str3); # 282| virNetMessageFree(msg); # 283| return ret; Error: CLANG_WARNING: libvirt-10.1.0/tests/virnetsockettest.c:285:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'lsock' # 283| virObjectUnref(lsock[i]); # 284| } # 285|-> VIR_FREE(lsock); # 286| if (tmpdir) # 287| rmdir(tmpdir); Error: CLANG_WARNING: libvirt-10.1.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.1.0/tests/xlconfigtest.c:77:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'gotxlcfgData' # 75| conn = virGetConnect(); # 76| if (!conn) # 77|-> return -1; # 78| # 79| if (replaceVars) { Error: CLANG_WARNING: libvirt-10.1.0/tests/xmconfigtest.c:50:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'gotxmcfgData' # 48| conn = virGetConnect(); # 49| if (!conn) # 50|-> return -1; # 51| # 52| if (!(def = virDomainDefParseFile(xml, driver->xmlopt, NULL, Error: CLANG_WARNING: libvirt-10.1.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.1.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.1.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.1.0/tools/nss/libvirt_nss_macs.c: scope_hint: In function ‘findMACsParserString’ libvirt-10.1.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.1.0/tools/virsh-checkpoint.c:790:15: warning[deadcode.DeadStores]: Although the value stored to 'xml' is used in the enclosing expression, the value is never actually read from 'xml' # 788| continue; # 789| # 790|-> if (!(xml = virXMLParseStringCtxt(doc, _("(domain_checkpoint)"), &ctxt))) # 791| continue; # 792| Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.1.0/tools/virsh-completer-checkpoint.c: scope_hint: In function ‘virshCheckpointNameCompleter’ libvirt-10.1.0/tools/virsh-completer-checkpoint.c:69:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’ libvirt-10.1.0/tools/vsh.h:28: included_from: Included from here. libvirt-10.1.0/tools/virsh-completer-checkpoint.h:23: included_from: Included from here. libvirt-10.1.0/tools/virsh-completer-checkpoint.c:23: included_from: Included from here. libvirt-10.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.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.1.0/tools/virsh-domain-monitor.c:1995:17: warning[deadcode.DeadStores]: Value stored to 'sep' is never read # 1993| if (optName) { # 1994| vshPrint(ctl, "%s%s", sep, virDomainGetName(dom)); # 1995|-> sep = " "; # 1996| } # 1997| vshPrint(ctl, "\n"); Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.1.0/tools/virsh-domain.c: scope_hint: In function ‘virshAddressParse’ libvirt-10.1.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.1.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.1.0/src/internal.h:30: included_from: Included from here. libvirt-10.1.0/tools/virsh.h:25: included_from: Included from here. libvirt-10.1.0/tools/virsh-domain.h:23: included_from: Included from here. libvirt-10.1.0/tools/virsh-domain.c:22: included_from: Included from here. libvirt-10.1.0/tools/virsh-domain.c:124:29: note: in expansion of macro ‘g_strdup’ libvirt-10.1.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-688): libvirt-10.1.0/tools/virsh-domain.c: scope_hint: In function ‘cmdSchedInfoUpdate’ libvirt-10.1.0/tools/virsh-domain.c:5182:25: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected /usr/include/glib-2.0/glib/gstrfuncs.h:324:38: note: in definition of macro ‘g_strdup’ libvirt-10.1.0/tools/virsh-domain.c:5180:38: note: in expansion of macro ‘g_strdup’ libvirt-10.1.0/tools/virsh-domain.c: scope_hint: In function ‘cmdSchedInfoUpdate’ <built-in>: note: argument 1 of ‘__builtin_strchr’ must be non-null # 5180| g_autofree char *set_field = g_strdup(opt->data); # 5181| # 5182|-> if (!(set_val = strchr(set_field, '='))) { # 5183| vshError(ctl, "%s", _("Invalid syntax for --set, expecting name=value")); # 5184| goto cleanup; Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.1.0/tools/virsh-domain.c: scope_hint: In function ‘getSignalNumber’ libvirt-10.1.0/tools/virsh-domain.c:8910:24: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘signame’ libvirt-10.1.0/tools/virsh-domain.c:8907:28: note: in expansion of macro ‘g_strdup’ libvirt-10.1.0/tools/virsh-domain.c: scope_hint: In function ‘getSignalNumber’ # 8908| char *p = str; # 8909| # 8910|-> for (i = 0; signame[i]; i++) # 8911| p[i] = g_ascii_tolower(signame[i]); # 8912| Error: CLANG_WARNING: libvirt-10.1.0/tools/virsh-host.c:264:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'nodes_free' # 262| } # 263| # 264|-> vshPrintExtra(ctl, "--------------------\n"); # 265| vshPrintExtra(ctl, "%5s: %10llu KiB\n", _("Total"), memory/1024); # 266| Error: CLANG_WARNING: libvirt-10.1.0/tools/virsh-host.c:264:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'nodes_id' # 262| } # 263| # 264|-> vshPrintExtra(ctl, "--------------------\n"); # 265| vshPrintExtra(ctl, "%5s: %10llu KiB\n", _("Total"), memory/1024); # 266| Error: CLANG_WARNING: libvirt-10.1.0/tools/virsh-host.c:348:15: warning[deadcode.DeadStores]: Although the value stored to 'doc' is used in the enclosing expression, the value is never actually read from 'doc' # 346| } # 347| # 348|-> if (!(doc = virXMLParseStringCtxt(cap_xml, _("capabilities"), &ctxt))) { # 349| vshError(ctl, "%s", _("unable to parse node capabilities")); # 350| goto cleanup; Error: CLANG_WARNING: libvirt-10.1.0/tools/virsh-host.c:472:12: warning[unix.Malloc]: Potential leak of memory pointed to by 'counts' # 470| } # 471| # 472|-> ret = !pagesize_missing; # 473| cleanup: # 474| VIR_FREE(nodes); Error: CLANG_WARNING: libvirt-10.1.0/tools/virsh-host.c:472:12: warning[unix.Malloc]: Potential leak of memory pointed to by 'pagesize' # 470| } # 471| # 472|-> ret = !pagesize_missing; # 473| cleanup: # 474| VIR_FREE(nodes); Error: CLANG_WARNING: libvirt-10.1.0/tools/virsh-host.c:632:15: warning[deadcode.DeadStores]: Although the value stored to 'xml' is used in the enclosing expression, the value is never actually read from 'xml' # 630| if ((caps = virConnectGetDomainCapabilities(priv->conn, NULL, NULL, NULL, # 631| type, 0))) { # 632|-> if (!(xml = virXMLParseStringCtxt(caps, _("(domainCapabilities)"), &ctxt))) # 633| return false; # 634| Error: CLANG_WARNING: libvirt-10.1.0/tools/virsh-host.c:1207:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'cpus' # 1205| # 1206| if (!(cpus[i] = virXMLNodeToString(xml, nodes[i]))) { # 1207|-> vshSaveLibvirtError(); # 1208| return NULL; # 1209| } Error: CLANG_WARNING: libvirt-10.1.0/tools/virsh-interface.c:837: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' # 835| # 836| /* make sure "new" device doesn't already exist */ # 837|-> if ((br_handle = virInterfaceLookupByName(priv->conn, br_name))) { # 838| vshError(ctl, _("Network device %1$s already exists"), br_name); # 839| goto cleanup; Error: CLANG_WARNING: libvirt-10.1.0/tools/virsh-network.c:1001:5: warning[unix.Malloc]: Potential leak of memory pointed to by '_pp.in' # 999| for (i = 0; i < nAllNets; i++) # 1000| VIR_FREE(names[i]); # 1001|-> VIR_FREE(names); # 1002| # 1003| if (!success) { Error: CLANG_WARNING: libvirt-10.1.0/tools/virsh-nodedev.c:563:9: warning[unix.Malloc]: Potential leak of memory pointed to by '_pp.in' # 561| for (i = 0; i < list->ndevices; i++) # 562| VIR_FREE(parents[i]); # 563|-> VIR_FREE(parents); # 564| for (i = 0; i < list->ndevices; i++) # 565| VIR_FREE(names[i]); Error: CLANG_WARNING: libvirt-10.1.0/tools/virsh-nodedev.c:566:9: warning[unix.Malloc]: Potential leak of memory pointed to by '_pp.in' # 564| for (i = 0; i < list->ndevices; i++) # 565| VIR_FREE(names[i]); # 566|-> VIR_FREE(names); # 567| } else { # 568| for (i = 0; i < list->ndevices; i++) Error: CLANG_WARNING: libvirt-10.1.0/tools/virsh-pool.c:494:11: warning[deadcode.DeadStores]: Although the value stored to 'pool' is used in the enclosing expression, the value is never actually read from 'pool' # 492| } # 493| # 494|-> if (!(pool = virStoragePoolCreateXML(priv->conn, xml, flags))) { # 495| vshError(ctl, _("Failed to create pool %1$s"), name); # 496| return false; Error: CLANG_WARNING: libvirt-10.1.0/tools/virsh-pool.c:584:11: warning[deadcode.DeadStores]: Although the value stored to 'pool' is used in the enclosing expression, the value is never actually read from 'pool' # 582| } # 583| # 584|-> if (!(pool = virStoragePoolDefineXML(priv->conn, xml, 0))) { # 585| vshError(ctl, _("Failed to define pool %1$s"), name); # 586| return false; Error: CLANG_WARNING: libvirt-10.1.0/tools/virsh-pool.c:1029:5: warning[unix.Malloc]: Potential leak of memory pointed to by '_pp.in' # 1027| } # 1028| # 1029|-> VIR_FREE(names); # 1030| return list; # 1031| } Error: CLANG_WARNING: libvirt-10.1.0/tools/virsh-pool.c:1395:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'poolInfoTexts' # 1393| } # 1394| } # 1395|-> VIR_FREE(poolInfoTexts); # 1396| # 1397| virshStoragePoolListFree(list); Error: CLANG_WARNING: libvirt-10.1.0/tools/virsh-pool.c:1836: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' # 1834| # 1835| /* Some old daemons don't support _INACTIVE flag */ # 1836|-> if (!(tmp_desc = virStoragePoolGetXMLDesc(pool, flags))) { # 1837| if (last_error->code == VIR_ERR_INVALID_ARG) { # 1838| flags &= ~VIR_STORAGE_XML_INACTIVE; Error: GCC_ANALYZER_WARNING (CWE-688): libvirt-10.1.0/tools/virsh-secret.c: scope_hint: In function ‘cmdSecretSetValue’ libvirt-10.1.0/tools/virsh-secret.c:254:22: warning[-Wanalyzer-null-argument]: use of NULL ‘secret_val’ where non-null expected libvirt-10.1.0/src/internal.h:58: included_from: Included from here. libvirt-10.1.0/tools/vsh.h:28: included_from: Included from here. libvirt-10.1.0/tools/virsh-secret.h:23: included_from: Included from here. libvirt-10.1.0/tools/virsh-secret.c:22: included_from: Included from here. libvirt-10.1.0/tools/virsh-secret.c:252: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.1.0/src/util/glibcompat.h:21: included_from: Included from here. libvirt-10.1.0/src/internal.h:30: included_from: Included from here. libvirt-10.1.0/tools/virsh-secret.c:253:22: note: in expansion of macro ‘g_strdup’ libvirt-10.1.0/tools/virsh-secret.c: scope_hint: In function ‘cmdSecretSetValue’ <built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null # 252| vshError(ctl, _("Passing secret value as command-line argument is insecure!")); # 253| secret_val = g_strdup(base64); # 254|-> secret_len = strlen(secret_val); # 255| } else if (filename) { # 256| ssize_t read_ret; Error: CLANG_WARNING: libvirt-10.1.0/tools/virsh-snapshot.c:666:15: warning[deadcode.DeadStores]: Although the value stored to 'snapshot2' is used in the enclosing expression, the value is never actually read from 'snapshot2' # 664| flags |= VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY; # 665| # 666|-> if (!(snapshot2 = virDomainSnapshotCreateXML(dom, xml, flags))) # 667| goto cleanup; # 668| Error: CLANG_WARNING: libvirt-10.1.0/tools/virsh-snapshot.c:1551:15: warning[deadcode.DeadStores]: Although the value stored to 'xml' is used in the enclosing expression, the value is never actually read from 'xml' # 1549| continue; # 1550| # 1551|-> if (!(xml = virXMLParseStringCtxt(doc, _("(domain_snapshot)"), &ctxt))) # 1552| continue; # 1553| Error: CLANG_WARNING: libvirt-10.1.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.1.0/tools/virsh-volume.c:353:15: warning[deadcode.DeadStores]: Although the value stored to 'vol' is used in the enclosing expression, the value is never actually read from 'vol' # 351| vshPrint(ctl, "%s", xml); # 352| } else { # 353|-> if (!(vol = virStorageVolCreateXML(pool, xml, flags))) { # 354| vshError(ctl, _("Failed to create vol %1$s"), name); # 355| return false; Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.1.0/tools/virsh-volume.c: scope_hint: In function ‘cmdVolList’ libvirt-10.1.0/tools/virsh-volume.c:1426:17: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘volInfoTexts’ # 1424| # 1425| for (i = 0; i < list->nvols; i++) { # 1426|-> if (vshTableRowAppend(table, # 1427| virStorageVolGetName(list->vols[i]), # 1428| volInfoTexts[i].path, Error: GCC_ANALYZER_WARNING (CWE-476): libvirt-10.1.0/tools/virsh-volume.c:1449:13: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘volInfoTexts’ # 1447| /* Insert the volume info rows into table */ # 1448| for (i = 0; i < list->nvols; i++) { # 1449|-> if (vshTableRowAppend(table, # 1450| virStorageVolGetName(list->vols[i]), # 1451| volInfoTexts[i].path, Error: CLANG_WARNING: libvirt-10.1.0/tools/virsh-volume.c:1478:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'volInfoTexts' # 1476| # 1477| /* Cleanup remaining memory */ # 1478|-> VIR_FREE(volInfoTexts); # 1479| virshStorageVolListFree(list); # 1480| Error: CLANG_WARNING: libvirt-10.1.0/tools/virt-login-shell-helper.c:349:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'shargv' # 347| shcmd = shargv[0]; # 348| if (!g_path_is_absolute(shcmd)) { # 349|-> virReportSystemError(errno, # 350| _("Shell '%1$s' should have absolute path"), # 351| shcmd); Error: CLANG_WARNING: libvirt-10.1.0/tools/virt-login-shell-helper.c:395:17: warning[unix.Malloc]: Potential leak of memory pointed to by 'shargv' # 393| * but as that may take a long time, we release resources now. */ # 394| cleanup: # 395|-> saved_err = virSaveLastError(); # 396| # 397| if (nfdlist > 0) Error: CLANG_WARNING: libvirt-10.1.0/tools/virt-login-shell-helper.c:409:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'seclabel' # 407| VIR_FREE(name); # 408| VIR_FREE(homedir); # 409|-> VIR_FREE(seclabel); # 410| VIR_FREE(secmodel); # 411| VIR_FREE(groups); Error: CLANG_WARNING: libvirt-10.1.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.1.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.1.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.1.0/tools/vsh-table.c:393:5: warning[unix.Malloc]: Potential leak of memory pointed to by '_pp.in' # 391| for (i = 0; i < table->nrows; i++) # 392| VIR_FREE(widths[i]); # 393|-> VIR_FREE(widths); # 394| return ret; # 395| } Error: CLANG_WARNING: libvirt-10.1.0/tools/vsh.c:661:25: warning[deadcode.DeadStores]: Value stored to 'fmt' during its initialization is never read # 659| const vshCmdOptDef *opt; # 660| for (opt = def->opts; opt->name; opt++) { # 661|-> const char *fmt = "%s"; # 662| switch (opt->type) { # 663| case VSH_OT_BOOL: Error: CLANG_WARNING: libvirt-10.1.0/tools/vsh.c:1062:14: warning[core.NullDereference]: Access to field 'data' results in a dereference of a null pointer (loaded from variable 'arg') # 1060| } # 1061| # 1062|-> *value = arg->data; # 1063| return 0; # 1064| } Error: CLANG_WARNING: libvirt-10.1.0/tools/vsh.c:1477:29: warning[deadcode.DeadStores]: Value stored to 'last' is never read # 1475| if (last) # 1476| last->next = arg; # 1477|-> last = arg; # 1478| } else { # 1479| vshError(ctl, Error: CLANG_WARNING: libvirt-10.1.0/tools/vsh.c:1544:24: warning[deadcode.DeadStores]: Value stored to 'tmpopt' during its initialization is never read # 1542| if (cmd) { # 1543| vshCmd *c = g_new0(vshCmd, 1); # 1544|-> vshCmdOpt *tmpopt = first; # 1545| # 1546| /* if we encountered --help, replace parsed command with Error: CLANG_WARNING: libvirt-10.1.0/tools/vsh.c:2233:17: warning[deadcode.DeadStores]: Value stored to 'lvl' during its initialization is never read # 2231| g_autofree char *str = NULL; # 2232| size_t len; # 2233|-> const char *lvl = ""; # 2234| g_autoptr(GDateTime) now = g_date_time_new_now_local(); # 2235| g_autofree gchar *nowstr = NULL; Error: CLANG_WARNING: libvirt-10.1.0/tools/vsh.c:2661:23: warning[core.NullDereference]: Access to field 'name' results in a dereference of a null pointer (loaded from field 'def') # 2659| # 2660| while (opt) { # 2661|-> if (STREQ(opt->def->name, name) && opt->def->type != VSH_OT_ARGV) { # 2662| exists = true; # 2663| break; Error: CLANG_WARNING: libvirt-10.1.0/tools/vsh.c:3169: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' # 3167| # 3168| if (vshCommandOptStringQuiet(ctl, cmd, "dir", &dir) <= 0) # 3169|-> dir = dir_malloced = virGetUserDirectory(); # 3170| if (!dir) # 3171| dir = "/";