summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/lib/talloc/talloc.c12
-rw-r--r--source4/lib/talloc/talloc.h1
-rw-r--r--source4/lib/talloc/talloc_guide.txt4
3 files changed, 15 insertions, 2 deletions
diff --git a/source4/lib/talloc/talloc.c b/source4/lib/talloc/talloc.c
index 7ba3e5f3ab..cc04a2425a 100644
--- a/source4/lib/talloc/talloc.c
+++ b/source4/lib/talloc/talloc.c
@@ -79,10 +79,9 @@
talloc_enable_leak_report_full() is called, otherwise it remains
NULL
*/
-static const void *null_context;
+static void *null_context;
static void *cleanup_context;
-
struct talloc_reference_handle {
struct talloc_reference_handle *next, *prev;
void *ptr;
@@ -909,6 +908,15 @@ void talloc_enable_null_tracking(void)
}
/*
+ disable tracking of the NULL context
+*/
+void talloc_disable_null_tracking(void)
+{
+ talloc_free(null_context);
+ null_context = NULL;
+}
+
+/*
enable leak reporting on exit
*/
void talloc_enable_leak_report(void)
diff --git a/source4/lib/talloc/talloc.h b/source4/lib/talloc/talloc.h
index b904029bda..f080f0498d 100644
--- a/source4/lib/talloc/talloc.h
+++ b/source4/lib/talloc/talloc.h
@@ -129,6 +129,7 @@ size_t talloc_total_blocks(const void *ptr);
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_disable_null_tracking(void);
void talloc_enable_leak_report(void);
void talloc_enable_leak_report_full(void);
void *_talloc_zero(const void *ctx, size_t size, const char *name);
diff --git a/source4/lib/talloc/talloc_guide.txt b/source4/lib/talloc/talloc_guide.txt
index 65fb2017a4..7f1a3ea6cd 100644
--- a/source4/lib/talloc/talloc_guide.txt
+++ b/source4/lib/talloc/talloc_guide.txt
@@ -432,6 +432,10 @@ This enables tracking of the NULL memory context without enabling leak
reporting on exit. Useful for when you want to do your own leak
reporting call via talloc_report_null_full();
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+void talloc_disable_null_tracking(void);
+
+This disables tracking of the NULL memory context.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
(type *)talloc_zero(const void *ctx, type);