summaryrefslogtreecommitdiff
path: root/source3/lib/debug.c
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-03-28 15:49:13 +0100
committerMichael Adam <obnox@samba.org>2008-03-28 16:34:51 +0100
commit9644b6cb50ec01c04a0d6ab17a8e39054fd8b0f8 (patch)
treed000e447b508b5a8c282957f5b7921e768da0884 /source3/lib/debug.c
parentcc2f5fd1b5aa7e7a7277557edfd4b94b0d10661d (diff)
downloadsamba-9644b6cb50ec01c04a0d6ab17a8e39054fd8b0f8.tar.gz
samba-9644b6cb50ec01c04a0d6ab17a8e39054fd8b0f8.tar.bz2
samba-9644b6cb50ec01c04a0d6ab17a8e39054fd8b0f8.zip
Add a talloc context parameter to current_timestring() to fix memleaks.
current_timestring used to return a string talloced to talloc_tos(). When called by DEBUG from a TALLOC_FREE, this produced messages "no talloc stackframe around, leaking memory". For example when used from net conf. This also adds a temporary talloc context to alloc_sub_basic(). For this purpose, the exit strategy is slightly altered: a common exit point is used for success and failure. Michael (This used to be commit 16b5800d4e3a8b88bac67b2550d14e0aaaa302a9)
Diffstat (limited to 'source3/lib/debug.c')
-rw-r--r--source3/lib/debug.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source3/lib/debug.c b/source3/lib/debug.c
index c4a0d1b47b..a76a8dbf53 100644
--- a/source3/lib/debug.c
+++ b/source3/lib/debug.c
@@ -1029,12 +1029,14 @@ bool dbghdr(int level, int cls, const char *file, const char *func, int line)
/* Print it all out at once to prevent split syslog output. */
if( lp_debug_prefix_timestamp() ) {
(void)Debug1( "[%s, %2d%s] ",
- current_timestring(lp_debug_hires_timestamp()), level,
- header_str);
+ current_timestring(debug_ctx(),
+ lp_debug_hires_timestamp()),
+ level, header_str);
} else {
(void)Debug1( "[%s, %2d%s] %s:%s(%d)\n",
- current_timestring(lp_debug_hires_timestamp()), level,
- header_str, file, func, line );
+ current_timestring(debug_ctx(),
+ lp_debug_hires_timestamp()),
+ level, header_str, file, func, line );
}
}