summaryrefslogtreecommitdiff
path: root/source4/lib/talloc
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-08-28 17:50:26 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:16:52 -0500
commit3400d91197aef446d6d113363f12edd7f14525a4 (patch)
treed4e5f0bc6efb4fbf0ae03eff64498936f73fa773 /source4/lib/talloc
parent98a1bd7fb3c3affa88972d5766753e6810cd1410 (diff)
downloadsamba-3400d91197aef446d6d113363f12edd7f14525a4.tar.gz
samba-3400d91197aef446d6d113363f12edd7f14525a4.tar.bz2
samba-3400d91197aef446d6d113363f12edd7f14525a4.zip
r17893: add a function to disable the null_context
metze (This used to be commit 7cab4285b1b61ad5cb425e42d89bcf7d645b0710)
Diffstat (limited to 'source4/lib/talloc')
-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);