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 738246 - libgdm: fix memory leaks
libgdm: fix memory leaks
Status: RESOLVED FIXED
Product: gdm
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: GDM maintainers
GDM maintainers
Depends on:
Blocks:
 
 
Reported: 2014-10-09 16:34 UTC by Owen Taylor
Modified: 2014-10-09 19:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Unref async results after calling g_simple_async_result_complete_in_idle() (10.14 KB, patch)
2014-10-09 16:34 UTC, Owen Taylor
committed Details | Review
Unref result of g_async_result_get_source_object() (1.43 KB, patch)
2014-10-09 16:34 UTC, Owen Taylor
committed Details | Review
Don't leak result of g_dbus_connection_new_for_address_finish() (3.03 KB, patch)
2014-10-09 16:34 UTC, Owen Taylor
committed Details | Review

Description Owen Taylor 2014-10-09 16:34:02 UTC
Various memory leaks found when investigating leftover objects after locking and
unlocking the screen in gnome-shell.
Comment 1 Owen Taylor 2014-10-09 16:34:04 UTC
Created attachment 288147 [details] [review]
Unref async results after calling g_simple_async_result_complete_in_idle()

All async results were leaked, since g_simple_async_result_complete_in_idle()
takes a new referring rather than assuming the ref passed in.
Comment 2 Owen Taylor 2014-10-09 16:34:12 UTC
Created attachment 288148 [details] [review]
Unref result of g_async_result_get_source_object()

g_async_result_get_source_object() returns a reference that must be
unreferenced.
Comment 3 Owen Taylor 2014-10-09 16:34:18 UTC
Created attachment 288149 [details] [review]
Don't leak result of g_dbus_connection_new_for_address_finish()

g_dbus_connection_new_for_address_finish() returns a new reference;
we can't simply ignore the returned connection, even though it is also
passed in as the source object of the GAsyncReadyCallback.
Comment 4 Ray Strode [halfline] 2014-10-09 18:44:04 UTC
Review of attachment 288147 [details] [review]:

looks right, docs say:

"Calling this function takes a reference to simple for as long as is needed to complete the call."

Commit message has a typo:

 s/referring/reference/
Comment 5 Ray Strode [halfline] 2014-10-09 18:48:24 UTC
Review of attachment 288148 [details] [review]:

looks right.  Docs say:

  a new reference to the source object for the res , or NULL if there is none.
  [transfer full]

A quick grep shows there aren't any other cases of g_async_result_get_source_object in the code.
Comment 6 Ray Strode [halfline] 2014-10-09 18:52:58 UTC
Review of attachment 288149 [details] [review]:

well you could unref the passed in object, but doing it the way you did reads a lot better. It's also consistent with the handling in on_connected.
Comment 7 Owen Taylor 2014-10-09 19:17:34 UTC
Pushed with the commit message fixed.

Attachment 288147 [details] pushed as f303808 - Unref async results after calling g_simple_async_result_complete_in_idle()
Attachment 288148 [details] pushed as eab417a - Unref result of g_async_result_get_source_object()
Attachment 288149 [details] pushed as 8bb0fbb - Don't leak result of g_dbus_connection_new_for_address_finish()