提交 81e99f01 编写于 作者: J Jiri Denemark

Fix error reporting when parsing CPU XML strings

上级 8d8815ea
......@@ -73,9 +73,10 @@ cpuCompareXML(virCPUDefPtr host,
virCPUDefPtr cpu = NULL;
virCPUCompareResult ret = VIR_CPU_COMPARE_ERROR;
doc = xmlParseMemory(xml, strlen(xml));
if (!(doc = virXMLParseString(xml, "cpu.xml")))
goto cleanup;
if (doc == NULL || (ctxt = xmlXPathNewContext(doc)) == NULL) {
if ((ctxt = xmlXPathNewContext(doc)) == NULL) {
virReportOOMError();
goto cleanup;
}
......@@ -268,8 +269,10 @@ cpuBaselineXML(const char **xmlCPUs,
goto no_memory;
for (i = 0; i < ncpus; i++) {
doc = xmlParseMemory(xmlCPUs[i], strlen(xmlCPUs[i]));
if (doc == NULL || (ctxt = xmlXPathNewContext(doc)) == NULL)
if (!(doc = virXMLParseString(xmlCPUs[i], "cpu.xml")))
goto error;
if ((ctxt = xmlXPathNewContext(doc)) == NULL)
goto no_memory;
ctxt->node = xmlDocGetRootElement(doc);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册