summaryrefslogtreecommitdiffstats
path: root/server/tests/resolv-tests.c
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2010-02-03 11:54:46 +0100
committerStephen Gallagher <sgallagh@redhat.com>2010-02-03 10:35:18 -0500
commit067fbea128ea5f6298feb37f9aaab347afd59d8a (patch)
treecdfcd2ab310a249dc510be271dfb7d7e547f3569 /server/tests/resolv-tests.c
parentf77224d2141c713afefd5f953515ad1e42dca3e5 (diff)
downloadsssd-067fbea128ea5f6298feb37f9aaab347afd59d8a.tar.gz
sssd-067fbea128ea5f6298feb37f9aaab347afd59d8a.tar.xz
sssd-067fbea128ea5f6298feb37f9aaab347afd59d8a.zip
Make resolve and failover test work with CK_FORK=no
The leak checking code which is used by the resolve and failover tests frees talloc's autofree context which is not recommended. As a consequence the initialization of tevent failed when it was called by the second test and CF_FORK=no, because it holds some data in the autofree context. This patch introduces a global talloc context which should be uses by the test as the root of their memory hierarchy instead of NULL. This global context is used in the leak checking routines. Not all types of memory leaks can be detected by the new version , it is recommended to use valgrind or similar tools additionally.
Diffstat (limited to 'server/tests/resolv-tests.c')
-rw-r--r--server/tests/resolv-tests.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/server/tests/resolv-tests.c b/server/tests/resolv-tests.c
index c1b327819..04b9e2e76 100644
--- a/server/tests/resolv-tests.c
+++ b/server/tests/resolv-tests.c
@@ -60,7 +60,7 @@ static int setup_resolv_test(struct resolv_test_ctx **ctx)
struct resolv_test_ctx *test_ctx;
int ret;
- test_ctx = talloc_zero(NULL, struct resolv_test_ctx);
+ test_ctx = talloc_zero(global_talloc_context, struct resolv_test_ctx);
if (test_ctx == NULL) {
fail("Could not allocate memory for test context");
return ENOMEM;
@@ -109,7 +109,7 @@ START_TEST(test_copy_hostent)
sizeof(addr_1), addr_list
};
- ctx = talloc_new(NULL);
+ ctx = talloc_new(global_talloc_context);
fail_if(ctx == NULL);
check_leaks_push(ctx);