summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-03-21 15:16:27 +0100
committerVolker Lendecke <vl@samba.org>2010-03-21 17:12:23 +0100
commit0f3040a61fc51434e07ed5a87a89eda25e196514 (patch)
tree5e986a2429b48306079acacd28b9dea08b9da1f8
parent6695b0e87d135dff759ce202cf61de49e062e946 (diff)
downloadsamba-0f3040a61fc51434e07ed5a87a89eda25e196514.tar.gz
samba-0f3040a61fc51434e07ed5a87a89eda25e196514.tar.bz2
samba-0f3040a61fc51434e07ed5a87a89eda25e196514.zip
Use calloc instead of ZERO_STRUCTP in talloc_stackframe_create()
-rw-r--r--lib/util/talloc_stack.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/util/talloc_stack.c b/lib/util/talloc_stack.c
index 2db56747a3..c11a88dda5 100644
--- a/lib/util/talloc_stack.c
+++ b/lib/util/talloc_stack.c
@@ -68,22 +68,20 @@ static void talloc_stackframe_init(void * unused)
static struct talloc_stackframe *talloc_stackframe_create(void)
{
#if defined(PARANOID_MALLOC_CHECKER)
-#ifdef malloc
-#undef malloc
+#ifdef calloc
+#undef calloc
#endif
#endif
- struct talloc_stackframe *ts = (struct talloc_stackframe *)malloc(
- sizeof(struct talloc_stackframe));
+ struct talloc_stackframe *ts = (struct talloc_stackframe *)calloc(
+ 1, sizeof(struct talloc_stackframe));
#if defined(PARANOID_MALLOC_CHECKER)
-#define malloc(s) __ERROR_DONT_USE_MALLOC_DIRECTLY
+#define calloc(n, s) __ERROR_DONT_USE_MALLOC_DIRECTLY
#endif
if (!ts) {
smb_panic("talloc_stackframe_init malloc failed");
}
- ZERO_STRUCTP(ts);
-
SMB_THREAD_ONCE(&ts_initialized, talloc_stackframe_init, NULL);
if (SMB_THREAD_SET_TLS(global_ts, ts)) {