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(a)redhat.com>
---
src/qemu/qemu_nbdkit.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/qemu/qemu_nbdkit.c b/src/qemu/qemu_nbdkit.c
index 66b09cd240..17819ca992 100644
--- a/src/qemu/qemu_nbdkit.c
+++ b/src/qemu/qemu_nbdkit.c
@@ -971,6 +971,9 @@ qemuNbdkitProcessBuildCommandAuth(virStorageAuthDef *authdef,
}
conn = virGetConnectSecret();
+ if (!conn)
+ return -1;
+
if (virSecretGetSecretString(conn,
&authdef->seclookupdef,
secrettype,
--
2.41.0