mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
Don't report OOM error on xmlCopyNode failure
Out of memory isn't the only reason the function can fail. Add a message stating that copying of a XML node failed. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
parent
ec6e2a2c97
commit
c3a5c67a84
@ -30459,7 +30459,8 @@ virDomainDefSetMetadata(virDomainDefPtr def,
|
|||||||
def->metadata = virXMLNewNode(NULL, "metadata");
|
def->metadata = virXMLNewNode(NULL, "metadata");
|
||||||
|
|
||||||
if (!(new = xmlCopyNode(doc->children, 1))) {
|
if (!(new = xmlCopyNode(doc->children, 1))) {
|
||||||
virReportOOMError();
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
|
_("Failed to copy XML node"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -224,7 +224,8 @@ testDomainDefNamespaceParse(xmlXPathContextPtr ctxt,
|
|||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
xmlNodePtr newnode = xmlCopyNode(nodes[i], 1);
|
xmlNodePtr newnode = xmlCopyNode(nodes[i], 1);
|
||||||
if (!newnode) {
|
if (!newnode) {
|
||||||
virReportOOMError();
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
|
_("Failed to copy XML node"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -787,7 +788,8 @@ testParseXMLDocFromFile(xmlNodePtr node, const char *file, const char *type)
|
|||||||
|
|
||||||
ret = xmlCopyNode(xmlDocGetRootElement(doc), 1);
|
ret = xmlCopyNode(xmlDocGetRootElement(doc), 1);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
virReportOOMError();
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
|
_("Failed to copy XML node"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
xmlReplaceNode(node, ret);
|
xmlReplaceNode(node, ret);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user