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(a)redhat.com>
---
src/util/viruri.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/util/viruri.c b/src/util/viruri.c
index 0aafd49d6d..1e8808ddc6 100644
--- a/src/util/viruri.c
+++ b/src/util/viruri.c
@@ -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;
}
--
2.29.2