summaryrefslogtreecommitdiffstats
path: root/bus
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-03-24 03:16:58 +0000
committerHavoc Pennington <hp@redhat.com>2003-03-24 03:16:58 +0000
commitc3af5ccdbc22e8990d04ec2f89ad1f2e053655e9 (patch)
tree6010b0b9a2be255b3ff3ac9f62e4c04ce57aef83 /bus
parenta26607ab68bf0878f23d2dbddec781b4b760d034 (diff)
2003-03-23 Havoc Pennington <hp@pobox.com>
* dbus/dbus-threads.c (dbus_mutex_new, dbus_condvar_new): with DBUS_BUILD_TESTS, actually alloc/free a block of memory for the mutex, so we can check for proper memory management and OOM handling. * dbus/dbus-dataslot.c: remove the mutex from DBusDataSlotAllocator and lock it manually when using it, to simplify fitting it into the global slots framework. * dbus/dbus-threads.c (init_static_locks): rework how we're handling global locks so they are easily shut down. * bus/policy.c (bus_policy_append_rule): fix * bus/test-main.c (main): check for memleaks * dbus/dbus-test.c (dbus_internal_do_not_use_run_tests): make test suite check for memleaks * dbus/dbus-memory.c: add support in test mode for tracking number of outstanding blocks
Diffstat (limited to 'bus')
-rw-r--r--bus/policy.c10
-rw-r--r--bus/test-main.c11
2 files changed, 20 insertions, 1 deletions
diff --git a/bus/policy.c b/bus/policy.c
index 015757a0..75013c85 100644
--- a/bus/policy.c
+++ b/bus/policy.c
@@ -73,6 +73,10 @@ bus_policy_rule_unref (BusPolicyRule *rule)
case BUS_POLICY_RULE_OWN:
dbus_free (rule->d.own.service_name);
break;
+ case BUS_POLICY_RULE_USER:
+ case BUS_POLICY_RULE_GROUP:
+ _dbus_assert_not_reached ("invalid rule");
+ break;
}
dbus_free (rule);
@@ -203,6 +207,10 @@ bus_policy_optimize (BusPolicy *policy)
remove_preceding =
rule->d.own.service_name == NULL;
break;
+ case BUS_POLICY_RULE_USER:
+ case BUS_POLICY_RULE_GROUP:
+ _dbus_assert_not_reached ("invalid rule");
+ break;
}
if (remove_preceding)
@@ -220,7 +228,7 @@ dbus_bool_t
bus_policy_append_rule (BusPolicy *policy,
BusPolicyRule *rule)
{
- if (!_dbus_list_append (policy->rules, rule))
+ if (!_dbus_list_append (&policy->rules, rule))
return FALSE;
bus_policy_rule_ref (rule);
diff --git a/bus/test-main.c b/bus/test-main.c
index 278e4a88..2e0b952e 100644
--- a/bus/test-main.c
+++ b/bus/test-main.c
@@ -26,6 +26,7 @@
#include <stdlib.h>
#include <dbus/dbus-string.h>
#include <dbus/dbus-sysdeps.h>
+#include <dbus/dbus-internals.h>
static void
die (const char *failure)
@@ -55,6 +56,16 @@ main (int argc, char **argv)
if (!bus_dispatch_test (&test_data_dir))
die ("dispatch");
+ dbus_shutdown ();
+
+ printf ("%s: checking for memleaks\n", argv[0]);
+ if (_dbus_get_malloc_blocks_outstanding () != 0)
+ {
+ _dbus_warn ("%d dbus_malloc blocks were not freed\n",
+ _dbus_get_malloc_blocks_outstanding ());
+ die ("memleaks");
+ }
+
printf ("%s: Success\n", argv[0]);
return 0;