]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virVBoxSnapshotConfSaveVboxFile: abort() on failure to allocate xmlDoc and comment
authorPeter Krempa <pkrempa@redhat.com>
Wed, 24 Feb 2021 10:28:56 +0000 (11:28 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 2 Mar 2021 08:50:20 +0000 (09:50 +0100)
'xmlNewDoc' and 'xmlNewDocComment' return NULL only on allocation
failure. Attempting to raise an error is pointless.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
src/vbox/vbox_snapshot_conf.c

index 5792d3175e675f91b9663a6ffe0549f96afde729..4f12d2ebfa380f299b194fe1c55c21f902def704 100644 (file)
@@ -996,10 +996,8 @@ virVBoxSnapshotConfSaveVboxFile(virVBoxSnapshotConfMachinePtr machine,
         goto cleanup;
     }
     xml = xmlNewDoc(BAD_CAST "1.0");
-    if (!xml) {
-        virReportOOMError();
-        goto cleanup;
-    }
+    if (!xml)
+        abort();
 
     cur = virXMLNewNode(NULL, "VirtualBox");
 
@@ -1023,10 +1021,8 @@ virVBoxSnapshotConfSaveVboxFile(virVBoxSnapshotConfMachinePtr machine,
                            "OVERWRITTEN AND LOST.\n"
                            "Changes to this xml configuration should be made using Virtualbox\n"
                            "or other application using the libvirt API");
-    if (!cur) {
-        virReportOOMError();
-        goto cleanup;
-    }
+    if (!cur)
+        abort();
 
     if (!xmlAddPrevSibling(xmlDocGetRootElement(xml), cur)) {
         virReportError(VIR_ERR_XML_ERROR, "%s",