From: Ján Tomko Date: Tue, 22 Sep 2020 22:59:59 +0000 (+0200) Subject: tests: cpuTestLoadMultiXML: use g_new0 instead of VIR_ALLOC_N X-Git-Tag: v6.8.0-rc1~54 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc9674c3181cb2a549e4131d3d1b8d254c2b2f77;p=thirdparty%2Flibvirt.git tests: cpuTestLoadMultiXML: use g_new0 instead of VIR_ALLOC_N Signed-off-by: Ján Tomko Reviewed-by: Peter Krempa --- diff --git a/tests/cputest.c b/tests/cputest.c index 83d63bf495..383da94938 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -111,11 +111,13 @@ cpuTestLoadMultiXML(virArch arch, goto cleanup; n = virXPathNodeSet("/cpuTest/cpu", ctxt, &nodes); - if (n <= 0 || (VIR_ALLOC_N(cpus, n) < 0)) { + if (n <= 0) { fprintf(stderr, "\nNo /cpuTest/cpu elements found in %s\n", xml); goto cleanup; } + cpus = g_new0(virCPUDefPtr, n); + for (i = 0; i < n; i++) { ctxt->node = nodes[i]; if (virCPUDefParseXML(ctxt, NULL, VIR_CPU_TYPE_HOST, &cpus[i]) < 0)