After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 766933 - GSocketAddress leaks in gnetworkmonitornetlink.c:read_netlink_messages()
GSocketAddress leaks in gnetworkmonitornetlink.c:read_netlink_messages()
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: network
2.49.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2016-05-27 07:15 UTC by Milan Crha
Modified: 2016-07-17 01:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch (1.29 KB, patch)
2016-05-27 07:30 UTC, Milan Crha
committed Details | Review
Fix memory leaks in GNetworkMonitorNetlink (1.67 KB, patch)
2016-07-17 01:15 UTC, Matthias Clasen
committed Details | Review

Description Milan Crha 2016-05-27 07:15:47 UTC
As claimed by valgrind in a downstream bug report:
https://bugzilla.redhat.com/show_bug.cgi?id=1317369

Finally, the log shows this as the most leaking part:
 118,864 (25,840 direct, 93,024 indirect) bytes in 646 blocks are definitely lost in loss record 25,430 of 25,505
    at 0xF1E9C88: g_type_create_instance (gtype.c:1853)
    by 0xF1CBB7A: g_object_new_internal (gobject.c:1779)
    by 0xF1CD460: g_object_newv (gobject.c:1926)
    by 0xF1CDD93: g_object_new (gobject.c:1619)
    by 0xEE9D340: g_native_socket_address_new (gnativesocketaddress.c:150)
    by 0xEEB22D4: g_socket_address_new_from_native (gsocketaddress.c:303)
    by 0xEEAFA10: cache_recv_address (gsocket.c:4333)
    by 0xEEAFA10: g_socket_receive_message (gsocket.c:4574)
    by 0xEEDCD3E: read_netlink_messages (gnetworkmonitornetlink.c:324)
    by 0xEEACAE0: socket_source_dispatch (gsocket.c:3284)
    by 0xF452E39: g_main_dispatch (gmain.c:3154)
    by 0xF452E39: g_main_context_dispatch (gmain.c:3769)
    by 0xF4531CF: g_main_context_iterate.isra.29 (gmain.c:3840)
    by 0xF4534F1: g_main_loop_run (gmain.c:4034)

The 'addr' variable is leaked there. The downstream bug report is against glib 2.46.2, but I verified that the code is the same in the current git master.
Comment 1 Milan Crha 2016-05-27 07:30:42 UTC
Created attachment 328627 [details] [review]
proposed patch
Comment 2 Colin Walters 2016-05-27 12:27:35 UTC
Review of attachment 328627 [details] [review]:

LGTM, however in the future would you mind making this a `git format-patch` style patch?  See https://wiki.gnome.org/Newcomers/SubmittingPatches

You can write one before pushing of course, but I like to review commit messages too.
Comment 3 Milan Crha 2016-05-27 12:39:04 UTC
(In reply to Colin Walters from comment #2)
> LGTM, however in the future would you mind making this a `git format-patch`
> style patch?  See https://wiki.gnome.org/Newcomers/SubmittingPatches

It's not made from a checkout, I even do not think I have any writeable. It's only a patch to make things easier for you and save you some time.
Comment 4 Colin Walters 2016-05-27 12:43:48 UTC
(In reply to Milan Crha from comment #3)
> (In reply to Colin Walters from comment #2)
> > LGTM, however in the future would you mind making this a `git format-patch`
> > style patch?  See https://wiki.gnome.org/Newcomers/SubmittingPatches
> 
> It's not made from a checkout, I even do not think I have any writeable.
> It's only a patch to make things easier for you and save you some time.

If you have a GNOME git account, you can commit to glib.  There's no per-module ACLs.
Comment 5 Matthias Clasen 2016-07-17 01:15:51 UTC
The following fix has been pushed:
4215c0c Fix memory leaks in GNetworkMonitorNetlink
Comment 6 Matthias Clasen 2016-07-17 01:15:58 UTC
Created attachment 331636 [details] [review]
Fix memory leaks in GNetworkMonitorNetlink

As claimed by valgrind in a downstream bug report:
https://bugzilla.redhat.com/show_bug.cgi?id=1317369