Bug 76401

Summary: memory leak from using dbus_g_method_get_sender wrong
Product: Telepathy Reporter: Simon McVittie <smcv>
Component: mission-controlAssignee: Simon McVittie <smcv>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium Keywords: patch
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: [5.16] fix memory leaks: dbus_g_method_get_sender returns a copy
[5.16] dispatcher_delegate_channels: initialize am

Description Simon McVittie 2014-03-20 13:01:52 UTC
While switching MC 'next' to GDBus I noticed that we're semi-consistently using dbus_g_method_get_sender wrong.
Comment 1 Simon McVittie 2014-03-20 13:02:23 UTC
Created attachment 96102 [details] [review]
[5.16] fix memory leaks: dbus_g_method_get_sender returns a copy

We were semi-consistently using it wrong.
Comment 2 Simon McVittie 2014-03-20 13:03:08 UTC
Created attachment 96103 [details] [review]
[5.16] dispatcher_delegate_channels: initialize am

Otherwise, if we "goto error" too soon, we'll try to g_object_unref
uninitialized memory. gcc doesn't spot that because we're using
tp_clear_object, which uses an intermediate variable, and it doesn't
propagate "uninitializedness" through assignments.

---

Happened to notice this while writing the previous patch.
Comment 3 Guillaume Desmottes 2014-05-07 12:15:06 UTC
Comment on attachment 96102 [details] [review]
[5.16] fix memory leaks: dbus_g_method_get_sender returns a copy

Review of attachment 96102 [details] [review]:
-----------------------------------------------------------------

++
Comment 4 Guillaume Desmottes 2014-05-07 12:15:28 UTC
Comment on attachment 96103 [details] [review]
[5.16] dispatcher_delegate_channels: initialize am

Review of attachment 96103 [details] [review]:
-----------------------------------------------------------------

++
Comment 5 George Kiagiadakis 2016-09-02 19:18:04 UTC
Merged.

commit f576a9e8a125c16e3a562e3bb820707c1041af5c
Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
Date:   Thu Mar 20 12:53:39 2014 +0000

    dispatcher_delegate_channels: initialize am
    
    Otherwise, if we "goto error" too soon, we'll try to g_object_unref
    uninitialized memory. gcc doesn't spot that because we're using
    tp_clear_object, which uses an intermediate variable, and it doesn't
    propagate "uninitializedness" through assignments.

commit 43afd2866bc38efe1b2cf27989df4e36ddd21201
Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
Date:   Thu Mar 20 12:51:18 2014 +0000

    fix memory leaks: dbus_g_method_get_sender returns a copy
    
    We were semi-consistently using it wrong.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.