From: Peter Krempa Date: Tue, 23 Feb 2021 17:28:31 +0000 (+0100) Subject: virURIFormat: abort() on failure X-Git-Tag: v7.2.0-rc1~277 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc622f55481246cfa746b835095b68c9a9bbe6a9;p=thirdparty%2Flibvirt.git 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 --- 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; }