mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 06:35:24 +00:00
Fix error reporting when parsing CPU XML strings
This commit is contained in:
parent
8d8815ea2a
commit
81e99f014b
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user