virVBoxSnapshotConfSaveVboxFile: abort() on failure to allocate xmlDoc and comment

'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>
This commit is contained in:
Peter Krempa 2021-02-24 11:28:56 +01:00
parent c0e65398d9
commit e09c852782

View File

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