summaryrefslogtreecommitdiff
path: root/source4/lib/talloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/talloc.c')
-rw-r--r--source4/lib/talloc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/source4/lib/talloc.c b/source4/lib/talloc.c
index 328a1ce1d1..21c3bdac6e 100644
--- a/source4/lib/talloc.c
+++ b/source4/lib/talloc.c
@@ -161,7 +161,11 @@ TALLOC_CTX *talloc_get_context(void *ptr)
struct talloc_chunk *tc;
tc = ((struct talloc_chunk *)ptr)-1;
- return tc->context;
+ if (tc->magic == TALLOC_MAGIC) {
+ return tc->context;
+ } else {
+ return NULL;
+ }
}
/** Allocate a bit of memory from the specified pool **/