gthreadedresolver: Unref unexpected address

I don't believe any real app would hit this, but we do leak
if it occurs.

Spotted by static analysis.

https://bugzilla.gnome.org/show_bug.cgi?id=733576
This commit is contained in:
Colin Walters 2014-07-22 14:08:00 -04:00
parent 49a5d0f6f2
commit e55a953642

View File

@ -88,8 +88,13 @@ do_lookup_by_name (GTask *task,
for (ai = res; ai; ai = ai->ai_next)
{
sockaddr = g_socket_address_new_from_native (ai->ai_addr, ai->ai_addrlen);
if (!sockaddr || !G_IS_INET_SOCKET_ADDRESS (sockaddr))
if (!sockaddr)
continue;
if (!G_IS_INET_SOCKET_ADDRESS (sockaddr))
{
g_clear_object (&sockaddr);
continue;
}
addr = g_object_ref (g_inet_socket_address_get_address ((GInetSocketAddress *)sockaddr));
addresses = g_list_prepend (addresses, addr);