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>
This commit is contained in:
Philip Withnall 2022-05-10 16:23:46 +01:00
parent 7767978725
commit e36f2bb243

View File

@ -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);