[patch] Fix for big memleak

Havoc Pennington hp at redhat.com
Tue Mar 8 09:58:38 PST 2005


Thanks, go for it.

Havoc

On Mon, 2005-03-07 at 19:22 -0500, Joe Shaw wrote:
> Hi,
> 
> Attached is a patch which fixes a pretty serious memory leak in d-bus.
> 
> 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.
> 
> I'm also attaching a test program which illustrates the problem.
> Without the patch the program grows to about 30 megs.  With the patch,
> only about 4.
> 
> Thanks,
> Joe



More information about the dbus mailing list