qemu_nbdkit: fix possible null dereference

Function virGetConnectSecret() can return NULL so we need to check it
since in virSecretGetSecretString() it gets dereferenced.

Reported-by: coverity
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Pavel Hrdina 2023-09-20 13:45:59 +02:00
parent b74fd210b3
commit ed80ce426e

View File

@ -971,6 +971,9 @@ qemuNbdkitProcessBuildCommandAuth(virStorageAuthDef *authdef,
}
conn = virGetConnectSecret();
if (!conn)
return -1;
if (virSecretGetSecretString(conn,
&authdef->seclookupdef,
secrettype,