GNOME Bugzilla – Bug 738246
libgdm: fix memory leaks
Last modified: 2014-10-09 19:17:47 UTC
Various memory leaks found when investigating leftover objects after locking and unlocking the screen in gnome-shell.
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.
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.
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.
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/
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.
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.
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()