summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/talloc.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/source4/lib/talloc.c b/source4/lib/talloc.c
index 421a09e3c6..328a1ce1d1 100644
--- a/source4/lib/talloc.c
+++ b/source4/lib/talloc.c
@@ -1,7 +1,7 @@
/*
Samba Unix SMB/CIFS implementation.
Samba temporary memory allocation functions
- Copyright (C) Andrew Tridgell 2000
+ Copyright (C) Andrew Tridgell 2000-2004
Copyright (C) 2001, 2002 by Martin Pool <mbp@samba.org>
This program is free software; you can redistribute it and/or modify
@@ -152,6 +152,18 @@ static TALLOC_CTX *talloc_init_internal(void)
}
+/*
+ return the talloc context given a pointer that has been allocated using
+ talloc
+*/
+TALLOC_CTX *talloc_get_context(void *ptr)
+{
+ struct talloc_chunk *tc;
+ tc = ((struct talloc_chunk *)ptr)-1;
+
+ return tc->context;
+}
+
/** Allocate a bit of memory from the specified pool **/
void *talloc(TALLOC_CTX *t, size_t size)
{