From f19cb44b988d6c523ad8409cfb7fc8e4fec1033a Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 8 Sep 2020 09:59:24 +0100 Subject: [PATCH] guri: Remove unnecessary NULL pointer check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `uri` is always non-`NULL` by the time the `fail` label is reached, so drop the `NULL` pointer check. Inline the `fail` code since it’s only used from two places. Coverity CID: #1430970 Signed-off-by: Philip Withnall --- glib/guri.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/glib/guri.c b/glib/guri.c index ad467987b..dc885a5d6 100644 --- a/glib/guri.c +++ b/glib/guri.c @@ -1257,13 +1257,17 @@ g_uri_parse_relative (GUri *base_uri, &uri->host, &uri->port, &uri->path, &uri->query, &uri->fragment, error)) - goto fail; + { + g_uri_unref (uri); + return NULL; + } if (!uri->scheme && !base_uri) { g_set_error_literal (error, G_URI_ERROR, G_URI_ERROR_FAILED, _("URI is not absolute, and no base URI was provided")); - goto fail; + g_uri_unref (uri); + return NULL; } if (base_uri) @@ -1326,11 +1330,6 @@ g_uri_parse_relative (GUri *base_uri, } return g_steal_pointer (&uri); - - fail: - if (uri) - g_uri_unref (uri); - return NULL; } /**