From: Peter Krempa Date: Tue, 23 Feb 2021 17:10:41 +0000 (+0100) Subject: Don't report OOM error on xmlCopyNode failure X-Git-Tag: v7.2.0-rc1~281 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3a5c67a8443f1b7bc838f36ae25b7cf25a3271b;p=thirdparty%2Flibvirt.git 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 Reviewed-by: Laine Stump --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a27fac4a29..f194909b13 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -30459,7 +30459,8 @@ virDomainDefSetMetadata(virDomainDefPtr def, def->metadata = virXMLNewNode(NULL, "metadata"); if (!(new = xmlCopyNode(doc->children, 1))) { - virReportOOMError(); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Failed to copy XML node")); return -1; } } diff --git a/src/test/test_driver.c b/src/test/test_driver.c index bca1297d1d..71ab04aa1a 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -224,7 +224,8 @@ testDomainDefNamespaceParse(xmlXPathContextPtr ctxt, for (i = 0; i < n; i++) { xmlNodePtr newnode = xmlCopyNode(nodes[i], 1); if (!newnode) { - virReportOOMError(); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Failed to copy XML node")); goto error; } @@ -787,7 +788,8 @@ testParseXMLDocFromFile(xmlNodePtr node, const char *file, const char *type) ret = xmlCopyNode(xmlDocGetRootElement(doc), 1); if (!ret) { - virReportOOMError(); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Failed to copy XML node")); goto error; } xmlReplaceNode(node, ret);