summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/lib/debug.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/source3/lib/debug.c b/source3/lib/debug.c
index 185c2373f4..87ec9ed8f5 100644
--- a/source3/lib/debug.c
+++ b/source3/lib/debug.c
@@ -90,6 +90,7 @@ bool AllowDebugChange = True;
*/
bool override_logfile;
+static TALLOC_CTX *tmp_debug_ctx;
/*
* This is to allow assignment to DEBUGLEVEL before the debug
@@ -856,6 +857,8 @@ void check_log_size( void )
errno = old_errno;
+ TALLOC_FREE(tmp_debug_ctx);
+
return( 0 );
}
@@ -1065,3 +1068,14 @@ bool dbghdr(int level, int cls, const char *file, const char *func, int line)
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;
+}