[SCM] Samba Shared Repository - branch master updated - tevent-0-9-8-571-g3c5d763
Andrew Tridgell
tridge at samba.org
Sun Sep 20 14:15:27 MDT 2009
The branch, master has been updated
via 3c5d7639624f6a82e75328e30dfd89e8ae728c55 (commit)
from 05653fce788d239433a93e68b71c1d280f02161a (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 3c5d7639624f6a82e75328e30dfd89e8ae728c55
Author: Andrew Tridgell <tridge at samba.org>
Date: Sun Sep 20 13:14:40 2009 -0700
talloc: fixed talloc_disable_null_tracking()
When we disable null tracking, we need to move any existing objects
that are under the null_context to be parented by the true NULL
context.
We also need a new talloc_enable_null_tracking_no_autofree() function,
as the talloc testsuite cannot cope with the moving of the autofree
context under the null_context as it wants to check exact counts of
objects under the null_context, and smbtorture has a large number of
objects in the autofree_context from .init functions
-----------------------------------------------------------------------
Summary of changes:
lib/talloc/talloc.c | 27 +++++++++++++++++++++++++++
lib/talloc/talloc.h | 1 +
lib/talloc/testsuite.c | 3 ++-
3 files changed, 30 insertions(+), 1 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/talloc/talloc.c b/lib/talloc/talloc.c
index f103a9b..7beda4b 100644
--- a/lib/talloc/talloc.c
+++ b/lib/talloc/talloc.c
@@ -1477,10 +1477,37 @@ void talloc_enable_null_tracking(void)
}
/*
+ enable tracking of the NULL context, not moving the autofree context
+ into the NULL context. This is needed for the talloc testsuite
+*/
+void talloc_enable_null_tracking_no_autofree(void)
+{
+ if (null_context == NULL) {
+ null_context = _talloc_named_const(NULL, 0, "null_context");
+ }
+}
+
+/*
disable tracking of the NULL context
*/
void talloc_disable_null_tracking(void)
{
+ if (null_context != NULL) {
+ /* we have to move any children onto the real NULL
+ context */
+ struct talloc_chunk *tc, *tc2;
+ tc = talloc_chunk_from_ptr(null_context);
+ for (tc2 = tc->child; tc2; tc2=tc2->next) {
+ if (tc2->parent == tc) tc2->parent = NULL;
+ if (tc2->prev == tc) tc2->prev = NULL;
+ }
+ for (tc2 = tc->next; tc2; tc2=tc2->next) {
+ if (tc2->parent == tc) tc2->parent = NULL;
+ if (tc2->prev == tc) tc2->prev = NULL;
+ }
+ tc->child = NULL;
+ tc->next = NULL;
+ }
talloc_free(null_context);
null_context = NULL;
}
diff --git a/lib/talloc/talloc.h b/lib/talloc/talloc.h
index 8241eeb..f549a17 100644
--- a/lib/talloc/talloc.h
+++ b/lib/talloc/talloc.h
@@ -163,6 +163,7 @@ void talloc_report_depth_file(const void *ptr, int depth, int max_depth, FILE *f
void talloc_report_full(const void *ptr, FILE *f);
void talloc_report(const void *ptr, FILE *f);
void talloc_enable_null_tracking(void);
+void talloc_enable_null_tracking_no_autofree(void);
void talloc_disable_null_tracking(void);
void talloc_enable_leak_report(void);
void talloc_enable_leak_report_full(void);
diff --git a/lib/talloc/testsuite.c b/lib/talloc/testsuite.c
index 8845d96..08aa208 100644
--- a/lib/talloc/testsuite.c
+++ b/lib/talloc/testsuite.c
@@ -518,6 +518,7 @@ static bool test_misc(void)
CHECK_SIZE("misc", NULL, 0);
+ talloc_enable_null_tracking_no_autofree();
talloc_enable_leak_report();
talloc_enable_leak_report_full();
@@ -1136,7 +1137,7 @@ static void test_reset(void)
talloc_set_log_fn(test_log_stdout);
test_abort_stop();
talloc_disable_null_tracking();
- talloc_enable_null_tracking();
+ talloc_enable_null_tracking_no_autofree();
}
struct torture_context;
--
Samba Shared Repository
More information about the samba-cvs
mailing list