[glib] Fix memory leaks in GNetworkMonitorNetlink
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Fix memory leaks in GNetworkMonitorNetlink
- Date: Sun, 17 Jul 2016 01:16:07 +0000 (UTC)
commit 4215c0ce9158288619308c5fa6d2aa57ed4506b7
Author: Milan Crha <mcrha redhat com>
Date: Fri May 27 07:30:00 2016 +0000
Fix memory leaks in GNetworkMonitorNetlink
As claimed by valgrind in a downstream bug report:
https://bugzilla.redhat.com/show_bug.cgi?id=1317369
https://bugzilla.gnome.org/show_bug.cgi?id=766933
gio/gnetworkmonitornetlink.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/gio/gnetworkmonitornetlink.c b/gio/gnetworkmonitornetlink.c
index b9ff011..776628b 100644
--- a/gio/gnetworkmonitornetlink.c
+++ b/gio/gnetworkmonitornetlink.c
@@ -295,7 +295,7 @@ read_netlink_messages (GSocket *socket,
gssize len;
gint flags;
GError *error = NULL;
- GSocketAddress *addr;
+ GSocketAddress *addr = NULL;
struct nlmsghdr *msg;
struct rtmsg *rtmsg;
struct rtattr *attr;
@@ -326,6 +326,7 @@ read_netlink_messages (GSocket *socket,
if (len < 0)
{
g_warning ("Error on netlink socket: %s", error->message);
+ g_clear_object (&addr);
g_error_free (error);
if (nl->priv->dump_networks)
finish_dump (nl);
@@ -335,6 +336,7 @@ read_netlink_messages (GSocket *socket,
if (!g_socket_address_to_native (addr, &source_sockaddr, sizeof (source_sockaddr), &error))
{
g_warning ("Error on netlink socket: %s", error->message);
+ g_clear_object (&addr);
g_error_free (error);
if (nl->priv->dump_networks)
finish_dump (nl);
@@ -425,6 +427,7 @@ read_netlink_messages (GSocket *socket,
done:
g_free (iv.buffer);
+ g_clear_object (&addr);
if (!retval && nl->priv->dump_networks)
finish_dump (nl);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]