summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-11-03 10:59:18 +0100
committerVolker Lendecke <vl@samba.org>2009-11-03 11:30:00 +0100
commitb067a5e4e83556d11a68ea1837ce4698762c123d (patch)
tree89eb5bcf6046db6f478e28846ddd74e22879e2d4 /source3/lib
parent558e2deda6798e06a6a64a25312b514566c38f66 (diff)
downloadsamba-b067a5e4e83556d11a68ea1837ce4698762c123d.tar.gz
samba-b067a5e4e83556d11a68ea1837ce4698762c123d.tar.bz2
samba-b067a5e4e83556d11a68ea1837ce4698762c123d.zip
s3: Remove debug_ctx()
smbd just crashed on me: In a debug message I called a routine preparing a string that itself used debug_ctx. The outer routine also used it after the inner routine had returned. It was still referencing the talloc context that the outer debug_ctx() had given us, which the inner DEBUG had already freed.
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/debug.c19
-rw-r--r--source3/lib/util_sid.c2
2 files changed, 3 insertions, 18 deletions
diff --git a/source3/lib/debug.c b/source3/lib/debug.c
index 2e19f89863..e851fd20e9 100644
--- a/source3/lib/debug.c
+++ b/source3/lib/debug.c
@@ -90,8 +90,6 @@ bool AllowDebugChange = True;
*/
bool override_logfile;
-static TALLOC_CTX *tmp_debug_ctx;
-
/*
* This is to allow assignment to DEBUGLEVEL before the debug
* system has been initialized.
@@ -888,8 +886,6 @@ void check_log_size( void )
}
done:
- TALLOC_FREE(tmp_debug_ctx);
-
errno = old_errno;
return( 0 );
@@ -1057,12 +1053,12 @@ bool dbghdrclass(int level, int cls, const char *location, const char *func)
/* Print it all out at once to prevent split syslog output. */
if( lp_debug_prefix_timestamp() ) {
(void)Debug1( "[%s, %2d%s] ",
- current_timestring(debug_ctx(),
+ current_timestring(talloc_tos(),
lp_debug_hires_timestamp()),
level, header_str);
} else {
(void)Debug1( "[%s, %2d%s] %s(%s)\n",
- current_timestring(debug_ctx(),
+ current_timestring(talloc_tos(),
lp_debug_hires_timestamp()),
level, header_str, location, func );
}
@@ -1110,14 +1106,3 @@ bool dbghdr(int level, const char *location, const char *func)
SAFE_FREE(msgbuf);
return ret;
}
-
-/*
- * Get us a temporary talloc context usable just for DEBUG arguments
- */
-TALLOC_CTX *debug_ctx(void)
-{
- if (tmp_debug_ctx == NULL) {
- tmp_debug_ctx = talloc_named_const(NULL, 0, "debug_ctx");
- }
- return tmp_debug_ctx;
-}
diff --git a/source3/lib/util_sid.c b/source3/lib/util_sid.c
index 9e5d4d38a5..639269cac2 100644
--- a/source3/lib/util_sid.c
+++ b/source3/lib/util_sid.c
@@ -201,7 +201,7 @@ char *sid_string_talloc(TALLOC_CTX *mem_ctx, const DOM_SID *sid)
char *sid_string_dbg(const DOM_SID *sid)
{
- return sid_string_talloc(debug_ctx(), sid);
+ return sid_string_talloc(talloc_tos(), sid);
}
/*****************************************************************