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 755535 - glib-networking memleak
glib-networking memleak
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
2.44.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks: 755530
 
 
Reported: 2015-09-24 11:25 UTC by Nicola
Modified: 2015-09-24 13:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fix (866 bytes, patch)
2015-09-24 11:25 UTC, Nicola
none Details | Review
update patch (918 bytes, patch)
2015-09-24 11:41 UTC, Nicola
reviewed Details | Review

Description Nicola 2015-09-24 11:25:09 UTC
Created attachment 312043 [details] [review]
fix

I found a memleak in glib-networking 2.44, my use case is a gstreamer pipeline with souphttpsrc element connecting via https, here is valgrind output

==9531== 38 bytes in 1 blocks are definitely lost in loss record 2,209 of 3,855
==9531== at 0x4C29E6F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9531== by 0x5AF91A9: g_malloc (gmem.c:97)
==9531== by 0x5B11B2E: g_strdup (gstrfuncs.c:356)
==9531== by 0xAF68670: g_tls_connection_gnutls_init_priorities (gtlsconnection-gnutls.c:246)
==9531== by 0xAF68670: g_tls_connection_gnutls_get_type (gtlsconnection-gnutls.c:72)
==9531== by 0xAF66104: g_tls_client_connection_gnutls_get_type (gtlsclientconnection-gnutls.c:51)
==9531== by 0x8CE05A6: soup_socket_setup_ssl (soup-socket.c:1352)
==9531== by 0x8CE170F: soup_socket_handshake_async (soup-socket.c:1499)
==9531== by 0x8CB9A05: socket_connect_complete (soup-connection.c:381)
==9531== by 0x95F2D12: g_task_return_now (gtask.c:1088)
==9531== by 0x95F338D: g_task_return (gtask.c:1146)
==9531== by 0x8CE02DC: async_connected (soup-socket.c:922)
==9531== by 0x95F2D12: g_task_return_now (gtask.c:1088)
==9531== by 0x95F338D: g_task_return (gtask.c:1146)
==9531== by 0x95EA349: g_socket_client_async_connect_complete (gsocketclient.c:1369)
==9531== by 0x95EA6A7: g_socket_client_connected_callback (gsocketclient.c:1519)
==9531== by 0x95F2D12: g_task_return_now (gtask.c:1088)
==9531== by 0x95F338D: g_task_return (gtask.c:1146)
==9531== by 0x95EBDCC: g_socket_connection_connect_callback (gsocketconnection.c:236)
==9531== by 0x95E4190: socket_source_dispatch (gsocket.c:3276)
==9531== by 0x5AF37A9: g_main_dispatch (gmain.c:3122)
==9531== by 0x5AF37A9: g_main_context_dispatch (gmain.c:3737)

the attached patch fix the problem,

I'm using 2.44 since this is the version used in cerbero and shipped with gstreamer builds. 

I did no test with 2.46, can you please review this patch and push to 2.44 branch? thanks
Comment 1 Emmanuele Bassi (:ebassi) 2015-09-24 11:28:08 UTC
Review of attachment 312043 [details] [review]:

Looks good, except for a minor coding style issue.

Could you also please add the bug reference to the commit message? That would be most helpful.

::: tls/gnutls/gtlsconnection-gnutls.c
@@ +255,3 @@
 					   cleaned_base,
 					   gnutls_protocol_get_name (fallback_proto));
+      g_free(cleaned_base);

Coding style: missing space between function name and parenthesis.
Comment 2 Nicola 2015-09-24 11:41:04 UTC
Created attachment 312046 [details] [review]
update patch

updated as requested, thanks!
Comment 3 Emmanuele Bassi (:ebassi) 2015-09-24 11:54:59 UTC
Review of attachment 312046 [details] [review]:

That looks good, thanks — but I noticed that the issue has been independently fixed in master by commit e9384e2cce11505a15a801512404bf44a40796e3. I apologize for not checking sooner.

I'll cherry pick the commit to the 2.44 branch, in case somebody is tracking it or if a new 2.44 release gets done.
Comment 4 Emmanuele Bassi (:ebassi) 2015-09-24 11:55:27 UTC
This problem has been fixed in our software repository. The fix will go into the next software release. Once that release is available, you may want to check for a software upgrade provided by your Linux distribution.