virURIFormat: abort() on failure

If the argument of 'xmlSaveUri' is non-NULL the function returns NULL on
OOM failure only. Thus we can directly abort rather than try to do the
impossible recovery.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
Peter Krempa 2021-02-23 18:28:31 +01:00
parent 06fc9f8e32
commit cc622f5548

View File

@ -238,11 +238,9 @@ virURIFormat(virURIPtr uri)
if (!xmluri.server && !xmluri.port)
xmluri.port = -1;
ret = (char *)xmlSaveUri(&xmluri);
if (!ret) {
virReportOOMError();
return NULL;
}
/* xmlSaveUri can fail only on OOM condition if argument is non-NULL */
if (!(ret = (char *)xmlSaveUri(&xmluri)))
abort();
return ret;
}