From debce401eb31ee5b6ffe08af6ccfc0a8bfd07a11 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Wed, 18 Aug 2004 21:22:07 +0000 Subject: r1898: Check the context we are going to return. (This used to be commit d721b122b5c443363b8f8ec2e1ef4b798378b658) --- source4/lib/talloc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 **/ -- cgit