mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 07:42:56 +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;
|
virCPUDefPtr cpu = NULL;
|
||||||
virCPUCompareResult ret = VIR_CPU_COMPARE_ERROR;
|
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();
|
virReportOOMError();
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -268,8 +269,10 @@ cpuBaselineXML(const char **xmlCPUs,
|
|||||||
goto no_memory;
|
goto no_memory;
|
||||||
|
|
||||||
for (i = 0; i < ncpus; i++) {
|
for (i = 0; i < ncpus; i++) {
|
||||||
doc = xmlParseMemory(xmlCPUs[i], strlen(xmlCPUs[i]));
|
if (!(doc = virXMLParseString(xmlCPUs[i], "cpu.xml")))
|
||||||
if (doc == NULL || (ctxt = xmlXPathNewContext(doc)) == NULL)
|
goto error;
|
||||||
|
|
||||||
|
if ((ctxt = xmlXPathNewContext(doc)) == NULL)
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
|
|
||||||
ctxt->node = xmlDocGetRootElement(doc);
|
ctxt->node = xmlDocGetRootElement(doc);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user