summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <withnall@endlessm.com>2020-09-08 09:59:24 +0100
committerPhilip Withnall <withnall@endlessm.com>2020-09-08 09:59:24 +0100
commitf19cb44b988d6c523ad8409cfb7fc8e4fec1033a (patch)
tree3bc7f6e1fb99cc2d38d54c6ab5844e7860da9de7
parent2effedd75b6026edaa8a292c352929c70003790b (diff)
downloadglib-f19cb44b988d6c523ad8409cfb7fc8e4fec1033a.tar.gz
guri: Remove unnecessary NULL pointer check
`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 <withnall@endlessm.com>
-rw-r--r--glib/guri.c13
1 files 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;
}
/**