]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
testsutilsqemu: check return value of virQEMUCapsNewCopy
authorJán Tomko <jtomko@redhat.com>
Fri, 20 Nov 2020 12:39:37 +0000 (13:39 +0100)
committerJán Tomko <jtomko@redhat.com>
Tue, 1 Dec 2020 16:25:31 +0000 (17:25 +0100)
While for virQEMUCapsNew this should not be needed
(the possible failures in VIR_CLASS_NEW are only hit
 on bad API usage which we don't do here),
virQEMUCapsNewCopy calls into many other functions,
some of which actually fail.

Check the return value of both.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
tests/testutilsqemu.c

index 906fdf5c1a659be03f42a9f8d79c36dcf816e019..cea4f84b14d6a362c587418046ebf9e601bdda65 100644 (file)
@@ -349,6 +349,9 @@ int qemuTestCapsCacheInsert(virFileCachePtr cache,
             tmpCaps = virQEMUCapsNew();
         }
 
+        if (!tmpCaps)
+            return -1;
+
         if (!virQEMUCapsHasMachines(tmpCaps)) {
             const char *defaultRAMid = NULL;