From: Michal Privoznik Date: Tue, 25 May 2021 09:30:33 +0000 (+0200) Subject: virxml: Report error if virXMLFormatMetadata() fails X-Git-Tag: v7.4.0-rc1~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c6402c635d269a37877e6824f216100d8613bd8;p=thirdparty%2Flibvirt.git virxml: Report error if virXMLFormatMetadata() fails I guess this is more of an academic problem, because if content was problematic we would have caught the error during parsing. Anyway, as is this function returns -1 without any error reported. Fix it by reporting one. Signed-off-by: Michal Privoznik Reviewed-by: Pavel Hrdina --- diff --git a/src/util/virxml.c b/src/util/virxml.c index 062a5402f6..91c6f6b02e 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -1740,6 +1740,8 @@ virXMLFormatMetadata(virBuffer *buf, if (xmlNodeDump(xmlbuf, metadata->doc, metadata, virBufferGetIndent(buf) / 2, 1) < 0) { xmlIndentTreeOutput = oldIndentTreeOutput; + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to format metadata element")); return -1; }