提交 8f0b0391 编写于 作者: J Jiri Denemark

tests: Fix build with -Werror

上级 3ecc06f4
...@@ -126,17 +126,17 @@ cpuTestLoadMultiXML(const char *arch, ...@@ -126,17 +126,17 @@ cpuTestLoadMultiXML(const char *arch,
goto cleanup; goto cleanup;
if (!(doc = virXMLParseFileCtxt(xml, &ctxt))) if (!(doc = virXMLParseFileCtxt(xml, &ctxt)))
goto error; goto cleanup;
n = virXPathNodeSet("/cpuTest/cpu", ctxt, &nodes); n = virXPathNodeSet("/cpuTest/cpu", ctxt, &nodes);
if (n <= 0 || (VIR_ALLOC_N(cpus, n) < 0)) if (n <= 0 || (VIR_ALLOC_N(cpus, n) < 0))
goto error; goto cleanup;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
ctxt->node = nodes[i]; ctxt->node = nodes[i];
cpus[i] = virCPUDefParseXML(nodes[i], ctxt, VIR_CPU_TYPE_HOST); cpus[i] = virCPUDefParseXML(nodes[i], ctxt, VIR_CPU_TYPE_HOST);
if (!cpus[i]) if (!cpus[i])
goto error; goto cleanup_cpus;
} }
*count = n; *count = n;
...@@ -148,13 +148,10 @@ cleanup: ...@@ -148,13 +148,10 @@ cleanup:
xmlFreeDoc(doc); xmlFreeDoc(doc);
return cpus; return cpus;
error: cleanup_cpus:
if (cpus) { for (i = 0; i < n; i++)
for (i = 0; i < n; i++) virCPUDefFree(cpus[i]);
virCPUDefFree(cpus[i]); VIR_FREE(cpus);
VIR_FREE(cpus);
cpus = NULL;
}
goto cleanup; goto cleanup;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册