]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virxml: Report error if virXMLFormatMetadata() fails
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 25 May 2021 09:30:33 +0000 (11:30 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 25 May 2021 11:17:22 +0000 (13:17 +0200)
I guess this is more of an academic problem, because if
<metadata/> 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 <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
src/util/virxml.c

index 062a5402f6f1297182b75a3cbe21483a3796d66f..91c6f6b02eda2d88916223b91e97b1c633ed0c98 100644 (file)
@@ -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;
     }