summaryrefslogtreecommitdiff
path: root/source3/lib/talloc/talloc.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-08-22 12:44:41 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:30:11 -0500
commit3b29c9cbede001ed0f228ad4738ee4f6604fd367 (patch)
treeb96d3a81b9b93c5dd36a8346b70ce90ce1bff3b5 /source3/lib/talloc/talloc.c
parente24b67fdd52dfa7f3dce9f380faf9f731a8e46e3 (diff)
downloadsamba-3b29c9cbede001ed0f228ad4738ee4f6604fd367.tar.gz
samba-3b29c9cbede001ed0f228ad4738ee4f6604fd367.tar.bz2
samba-3b29c9cbede001ed0f228ad4738ee4f6604fd367.zip
r24627: merge from SAMBA_4_0:
as TALLOC_ABORT() is defined to abort() by default wrap it into a function so that the function name in the backtrace shows what happens. metze (This used to be commit ddbe971030070ab1b9fc37b8b0ac44a3d9303fe4)
Diffstat (limited to 'source3/lib/talloc/talloc.c')
-rw-r--r--source3/lib/talloc/talloc.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/source3/lib/talloc/talloc.c b/source3/lib/talloc/talloc.c
index 6ebdada42f..c073a8c774 100644
--- a/source3/lib/talloc/talloc.c
+++ b/source3/lib/talloc/talloc.c
@@ -115,6 +115,16 @@ struct talloc_chunk {
#define TC_HDR_SIZE ((sizeof(struct talloc_chunk)+15)&~15)
#define TC_PTR_FROM_CHUNK(tc) ((void *)(TC_HDR_SIZE + (char*)tc))
+static void talloc_abort_double_free(void)
+{
+ TALLOC_ABORT("Bad talloc magic value - double free");
+}
+
+static void talloc_abort_unknown_value(void)
+{
+ TALLOC_ABORT("Bad talloc magic value - unknown value");
+}
+
/* panic if we get a bad magic value */
static inline struct talloc_chunk *talloc_chunk_from_ptr(const void *ptr)
{
@@ -122,9 +132,9 @@ static inline struct talloc_chunk *talloc_chunk_from_ptr(const void *ptr)
struct talloc_chunk *tc = discard_const_p(struct talloc_chunk, pp - TC_HDR_SIZE);
if (unlikely((tc->flags & (TALLOC_FLAG_FREE | ~0xF)) != TALLOC_MAGIC)) {
if (tc->flags & TALLOC_FLAG_FREE) {
- TALLOC_ABORT("Bad talloc magic value - double free");
+ talloc_abort_double_free();
} else {
- TALLOC_ABORT("Bad talloc magic value - unknown value");
+ talloc_abort_unknown_value();
}
}
return tc;