From cc622f55481246cfa746b835095b68c9a9bbe6a9 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Tue, 23 Feb 2021 18:28:31 +0100 Subject: [PATCH] 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 Reviewed-by: Laine Stump --- 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.47.2