mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 23:46:17 +01:00
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
This commit is contained in:
parent
e3e3ed0d7d
commit
4215c0ce91
@ -295,7 +295,7 @@ read_netlink_messages (GSocket *socket,
|
|||||||
gssize len;
|
gssize len;
|
||||||
gint flags;
|
gint flags;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GSocketAddress *addr;
|
GSocketAddress *addr = NULL;
|
||||||
struct nlmsghdr *msg;
|
struct nlmsghdr *msg;
|
||||||
struct rtmsg *rtmsg;
|
struct rtmsg *rtmsg;
|
||||||
struct rtattr *attr;
|
struct rtattr *attr;
|
||||||
@ -326,6 +326,7 @@ read_netlink_messages (GSocket *socket,
|
|||||||
if (len < 0)
|
if (len < 0)
|
||||||
{
|
{
|
||||||
g_warning ("Error on netlink socket: %s", error->message);
|
g_warning ("Error on netlink socket: %s", error->message);
|
||||||
|
g_clear_object (&addr);
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
if (nl->priv->dump_networks)
|
if (nl->priv->dump_networks)
|
||||||
finish_dump (nl);
|
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))
|
if (!g_socket_address_to_native (addr, &source_sockaddr, sizeof (source_sockaddr), &error))
|
||||||
{
|
{
|
||||||
g_warning ("Error on netlink socket: %s", error->message);
|
g_warning ("Error on netlink socket: %s", error->message);
|
||||||
|
g_clear_object (&addr);
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
if (nl->priv->dump_networks)
|
if (nl->priv->dump_networks)
|
||||||
finish_dump (nl);
|
finish_dump (nl);
|
||||||
@ -425,6 +427,7 @@ read_netlink_messages (GSocket *socket,
|
|||||||
|
|
||||||
done:
|
done:
|
||||||
g_free (iv.buffer);
|
g_free (iv.buffer);
|
||||||
|
g_clear_object (&addr);
|
||||||
|
|
||||||
if (!retval && nl->priv->dump_networks)
|
if (!retval && nl->priv->dump_networks)
|
||||||
finish_dump (nl);
|
finish_dump (nl);
|
||||||
|
Loading…
Reference in New Issue
Block a user