[patch] Fix for big memleak
Joe Shaw
joeshaw at novell.com
Mon Mar 7 16:22:51 PST 2005
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbus-leak.patch
Type: text/x-patch
Size: 698 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20050307/b8721a2a/dbus-leak.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbus-torture.c
Type: text/x-csrc
Size: 615 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20050307/b8721a2a/dbus-torture.c
More information about the dbus
mailing list