How to free ressources allocated by dbus_bus_get ?
10function
10function at ifrance.com
Tue Nov 7 06:08:35 PST 2006
Hi Guyz,
I was wondering how memory ressources claimed by 'dbus_bus_get' should be released.
I used 'dbus_connection_unref' and 'dbus_connection_close' calls, but memory leaks are always present.
Here's the sample/simple program i used:
#define DBUS_API_SUBJECT_TO_CHANGE
#include <dbus/dbus.h>
int main()
{
DBusError err;
DBusConnection* conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
dbus_connection_unref(conn); /* check with dbus_connection_close also */
return(0);
}
And the valgrind/memchecks complains :
==29576== 16 bytes in 2 blocks are still reachable in loss record 1 of 4
==29576== at 0x1B90459D: malloc (vg_replace_malloc.c:130)
==29576== by 0x1B904FFA: realloc (vg_replace_malloc.c:188)
==29576== by 0x1B92FC14: dbus_realloc (in /usr/lib/libdbus-1.so.3)
==29576== by 0x1B92CD00: (within /usr/lib/libdbus-1.so.3)
==29576== by 0x1B91B609: dbus_connection_allocate_data_slot (in /usr/lib/libdbus-1.so.3)
==29576== by 0x1B916EF5: (within /usr/lib/libdbus-1.so.3)
==29576== by 0x1B917023: dbus_bus_register (in /usr/lib/libdbus-1.so.3)
==29576== by 0x1B91733B: (within /usr/lib/libdbus-1.so.3)
==29576== by 0x804840D: main (memory-leaks.c:7)
==29576==
==29576==
==29576== 985 bytes in 25 blocks are still reachable in loss record 2 of 4
==29576== at 0x1B90459D: malloc (vg_replace_malloc.c:130)
==29576== by 0x1B92FB82: dbus_malloc (in /usr/lib/libdbus-1.so.3)
==29576== by 0x1B92DC44: (within /usr/lib/libdbus-1.so.3)
==29576== by 0x1B917436: (within /usr/lib/libdbus-1.so.3)
==29576== by 0x804840D: main (memory-leaks.c:7)
==29576==
==29576==
==29576== 1240 bytes in 17 blocks are still reachable in loss record 3 of 4
==29576== at 0x1B904F75: calloc (vg_replace_malloc.c:175)
==29576== by 0x1B92FBB4: dbus_malloc0 (in /usr/lib/libdbus-1.so.3)
==29576== by 0x1B92FD7E: (within /usr/lib/libdbus-1.so.3)
==29576== by 0x1B92E1FE: (within /usr/lib/libdbus-1.so.3)
==29576== by 0x1B92E3AD: (within /usr/lib/libdbus-1.so.3)
==29576== by 0x1B92E3F0: (within /usr/lib/libdbus-1.so.3)
==29576== by 0x1B9142DE: dbus_parse_address (in /usr/lib/libdbus-1.so.3)
==29576== by 0x1B91A619: (within /usr/lib/libdbus-1.so.3)
==29576== by 0x1B917317: (within /usr/lib/libdbus-1.so.3)
==29576== by 0x804840D: main (memory-leaks.c:7)
==29576==
==29576==
==29576== 5198 bytes in 11 blocks are still reachable in loss record 4 of 4
==29576== at 0x1B90506F: realloc (vg_replace_malloc.c:196)
==29576== by 0x1B92FC14: dbus_realloc (in /usr/lib/libdbus-1.so.3)
==29576== by 0x1B93019D: (within /usr/lib/libdbus-1.so.3)
==29576== by 0x1B930689: (within /usr/lib/libdbus-1.so.3)
==29576== by 0x1B91491A: (within /usr/lib/libdbus-1.so.3)
==29576== by 0x1B9165B0: (within /usr/lib/libdbus-1.so.3)
==29576== by 0x1B9296A4: (within /usr/lib/libdbus-1.so.3)
==29576== by 0x1B92B197: (within /usr/lib/libdbus-1.so.3)
==29576== by 0x1B92B550: (within /usr/lib/libdbus-1.so.3)
==29576== by 0x1B92B656: (within /usr/lib/libdbus-1.so.3)
==29576== by 0x1B929847: (within /usr/lib/libdbus-1.so.3)
==29576== by 0x1B91A6B2: (within /usr/lib/libdbus-1.so.3)
Thanks for your gurus eyes ...
Today's piece of secure software is the subject of tomorrow's Bugtraq posting
________________________________________________________________________
iFRANCE, exprimez-vous !
http://web.ifrance.com
More information about the dbus
mailing list