[patch] leak fix, redux

Joe Shaw joeshaw at novell.com
Thu Mar 10 15:44:08 PST 2005


So my last patch to fix the pending call leak wasn't quite right.

> When a DBusPendingCall is created in dbus_connection_send_with_reply(),
> it has a refcount of 1.  The refcount is incremented in
> _dbus_connection_attach_pending_call_unlocked(), and handles unreffing
> it later.  The initial ref from the creation is never released, however,
> and so both the pending call and the attached DBusMessage reply are
> leaked.  This patch unrefs the pending after attaching it to the
> connection, effectively passing the ownership on.

The initial ref *is* released, it turns out, by the unref following
stealing the reply in dbus_connection_send_with_reply_and_block().

There is an unmatched ref, though, in
_dbus_connection_block_pending_call().  This patch reverts the unref
from my original patch and adds unrefs at all of the exit points from
this function.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbus-leak-2.patch
Type: text/x-patch
Size: 2140 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20050310/7da64550/dbus-leak-2.bin

More information about the dbus mailing list