From 4560736c9c124549bd6f2cfa1147c7281e0287ae Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 22 Sep 2021 10:53:58 +0200 Subject: [PATCH] testQemuInfoInitArgs: Report error if path to 'latest' caps for an arch is NULL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When looking up the 'latest' caps they might not be present. Report an error instead of crashing. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- tests/testutilsqemu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index 164d601613..505c66b818 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -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",