]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
testQemuInfoInitArgs: Report error if path to 'latest' caps for an arch is NULL
authorPeter Krempa <pkrempa@redhat.com>
Wed, 22 Sep 2021 08:53:58 +0000 (10:53 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 23 Sep 2021 12:48:50 +0000 (14:48 +0200)
When looking up the 'latest' caps they might not be present. Report an
error instead of crashing.

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

index 164d601613c8bdbd525c79097bbbc4675f6078e0..505c66b818484ee559f56319b05946013ce975ec 100644 (file)
@@ -772,6 +772,12 @@ testQemuInfoInitArgs(struct testQemuInfo *info)
 
         if (STREQ(info->args.capsver, "latest")) {
             capsfile = g_strdup(virHashLookup(info->conf->capslatest, info->args.capsarch));
+
+            if (!capsfile) {
+                fprintf(stderr, "'latest' caps for '%s' were not found\n", info->args.capsarch);
+                return -1;
+            }
+
             stripmachinealiases = true;
         } else {
             capsfile = g_strdup_printf("%s/caps_%s.%s.xml",