summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2004-08-18 21:22:07 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:58:09 -0500
commitdebce401eb31ee5b6ffe08af6ccfc0a8bfd07a11 (patch)
tree6670d31c0bdf89d8b38027d03d099b3b1368e634
parent1129c7808354dc04f7725be505fd23c0bf11a29d (diff)
downloadsamba-debce401eb31ee5b6ffe08af6ccfc0a8bfd07a11.tar.gz
samba-debce401eb31ee5b6ffe08af6ccfc0a8bfd07a11.tar.bz2
samba-debce401eb31ee5b6ffe08af6ccfc0a8bfd07a11.zip
r1898: Check the context we are going to return.
(This used to be commit d721b122b5c443363b8f8ec2e1ef4b798378b658)
-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 **/