diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-08-22 12:44:22 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 15:02:26 -0500 |
commit | 69de8f9ac8eaa9bb8ec12facb66fe3e26de5f47c (patch) | |
tree | c253917e01c9f5f501b925a9087b966854bbdd12 | |
parent | 1035a6696d57d0cc7ecb1b869e2dce6fd5df9683 (diff) | |
download | samba-69de8f9ac8eaa9bb8ec12facb66fe3e26de5f47c.tar.gz samba-69de8f9ac8eaa9bb8ec12facb66fe3e26de5f47c.tar.bz2 samba-69de8f9ac8eaa9bb8ec12facb66fe3e26de5f47c.zip |
r24626: 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 0216ff6daa276e413811ca32cca0a66b4b2abe55)
-rw-r--r-- | source4/lib/talloc/talloc.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/source4/lib/talloc/talloc.c b/source4/lib/talloc/talloc.c index 6ebdada42f..c073a8c774 100644 --- a/source4/lib/talloc/talloc.c +++ b/source4/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; |