svn commit: samba r24627 - in branches/SAMBA_3_2/source/lib/talloc:
.
metze at samba.org
metze at samba.org
Wed Aug 22 12:44:43 GMT 2007
Author: metze
Date: 2007-08-22 12:44:41 +0000 (Wed, 22 Aug 2007)
New Revision: 24627
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24627
Log:
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
Modified:
branches/SAMBA_3_2/source/lib/talloc/talloc.c
Changeset:
Modified: branches/SAMBA_3_2/source/lib/talloc/talloc.c
===================================================================
--- branches/SAMBA_3_2/source/lib/talloc/talloc.c 2007-08-22 12:44:22 UTC (rev 24626)
+++ branches/SAMBA_3_2/source/lib/talloc/talloc.c 2007-08-22 12:44:41 UTC (rev 24627)
@@ -115,6 +115,16 @@
#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 @@
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;
More information about the samba-cvs
mailing list