From f7c24715b5489b28b47499eb252b941b735fa1bc Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Mon, 17 Mar 2003 05:39:10 +0000 Subject: 2003-03-17 Havoc Pennington All tests pass, no memleaks, no valgrind complaints. * bus/test.c: refcount handler_slot * bus/connection.c (bus_connections_new): refcount connection_data_slot * dbus/dbus-auth-script.c (_dbus_auth_script_run): delete unused bytes so that auth scripts pass. * bus/dispatch.c: init message_handler_slot so it gets allocated properly * bus/dispatch.c (message_handler_slot_ref): fix memleak * dbus/dbus-server-debug-pipe.c (_dbus_server_debug_pipe_new): dealloc server_pipe_hash when no longer used for benefit of leak checking * dbus/dbus-auth.c (process_command): memleak fix * bus/dispatch.c (check_hello_message): memleak fix --- dbus/dbus-dataslot.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'dbus/dbus-dataslot.c') diff --git a/dbus/dbus-dataslot.c b/dbus/dbus-dataslot.c index 53fb9e4c..46e2bfc1 100644 --- a/dbus/dbus-dataslot.c +++ b/dbus/dbus-dataslot.c @@ -57,6 +57,10 @@ _dbus_data_slot_allocator_init (DBusDataSlotAllocator *allocator) * Allocates an integer ID to be used for storing data * in a #DBusDataSlotList. * + * @todo all over the code we have foo_slot and foo_slot_refcount, + * would be better to add an interface for that to + * DBusDataSlotAllocator so it isn't cut-and-pasted everywhere. + * * @param allocator the allocator * @returns the integer ID, or -1 on failure */ @@ -103,6 +107,9 @@ _dbus_data_slot_allocator_alloc (DBusDataSlotAllocator *allocator) _dbus_assert (slot >= 0); _dbus_assert (slot < allocator->n_allocated_slots); + + _dbus_verbose ("Allocated slot %d on allocator %p total %d slots allocated %d used\n", + slot, allocator, allocator->n_allocated_slots, allocator->n_used_slots); out: dbus_mutex_unlock (allocator->lock); @@ -137,6 +144,9 @@ _dbus_data_slot_allocator_free (DBusDataSlotAllocator *allocator, allocator->allocated_slots = NULL; allocator->n_allocated_slots = 0; } + + _dbus_verbose ("Freed slot %d on allocator %p total %d allocated %d used\n", + slot, allocator, allocator->n_allocated_slots, allocator->n_used_slots); dbus_mutex_unlock (allocator->lock); } @@ -243,6 +253,7 @@ _dbus_data_slot_list_get (DBusDataSlotAllocator *allocator, */ if (!dbus_mutex_lock (allocator->lock)) return FALSE; + _dbus_assert (slot >= 0); _dbus_assert (slot < allocator->n_allocated_slots); _dbus_assert (allocator->allocated_slots[slot] == slot); dbus_mutex_unlock (allocator->lock); -- cgit