[glib] gthreadedresolver: Unref unexpected address
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gthreadedresolver: Unref unexpected address
- Date: Wed, 23 Jul 2014 11:47:18 +0000 (UTC)
commit e55a953642a9e402f4363f9fa347b6061dd78990
Author: Colin Walters <walters verbum org>
Date: Tue Jul 22 14:08:00 2014 -0400
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
gio/gthreadedresolver.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/gio/gthreadedresolver.c b/gio/gthreadedresolver.c
index 9bb864c..c02c593 100644
--- a/gio/gthreadedresolver.c
+++ b/gio/gthreadedresolver.c
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]