[glib: 3/5] gproxyaddressenumerator: Factor out type check
- From: Simon McVittie <smcv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 3/5] gproxyaddressenumerator: Factor out type check
- Date: Tue, 10 May 2022 16:30:20 +0000 (UTC)
commit e36f2bb24364a9deebe9d2f7d3e81021e9f174bf
Author: Philip Withnall <pwithnall endlessos org>
Date: Tue May 10 16:23:46 2022 +0100
gproxyaddressenumerator: Factor out type check
This will help static analysers which think that the type of
`priv->proxy_address` could potentially change between freeing
`dest_hostname` and the `g_return_if_fail()` call below, leading to the
code to continue through to `g_object_new()` and use `dest_hostname`
after freeing it.
This introduces no functional changes.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
gio/gproxyaddressenumerator.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gio/gproxyaddressenumerator.c b/gio/gproxyaddressenumerator.c
index 654baade57..e841a902f5 100644
--- a/gio/gproxyaddressenumerator.c
+++ b/gio/gproxyaddressenumerator.c
@@ -325,6 +325,7 @@ return_result (GTask *task)
{
GProxyAddressEnumeratorPrivate *priv = g_task_get_task_data (task);
GSocketAddress *result;
+ gboolean is_inet_socket_address;
if (strcmp ("direct", priv->proxy_type) == 0)
{
@@ -356,12 +357,13 @@ return_result (GTask *task)
}
dest_protocol = g_uri_parse_scheme (priv->dest_uri);
- if (!G_IS_INET_SOCKET_ADDRESS (priv->proxy_address))
+ is_inet_socket_address = G_IS_INET_SOCKET_ADDRESS (priv->proxy_address);
+ if (!is_inet_socket_address)
{
g_free (dest_hostname);
g_free (dest_protocol);
}
- g_return_if_fail (G_IS_INET_SOCKET_ADDRESS (priv->proxy_address));
+ g_return_if_fail (is_inet_socket_address);
inetsaddr = G_INET_SOCKET_ADDRESS (priv->proxy_address);
inetaddr = g_inet_socket_address_get_address (inetsaddr);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]