summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/lib/util/debug.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/source4/lib/util/debug.h b/source4/lib/util/debug.h
index 1895ed53ad..605628174a 100644
--- a/source4/lib/util/debug.h
+++ b/source4/lib/util/debug.h
@@ -41,13 +41,17 @@ struct debug_ops {
extern int DEBUGLEVEL;
+#define debug_ctx() (_debug_ctx?_debug_ctx:(_debug_ctx=talloc_new(NULL)))
+
#define DEBUGLVL(level) ((level) <= DEBUGLEVEL)
#define _DEBUG(level, body, header) do { \
if (DEBUGLVL(level)) { \
+ void* _debug_ctx=NULL; \
if (header) { \
do_debug_header(level, __location__, __FUNCTION__); \
} \
do_debug body; \
+ talloc_free(_debug_ctx); \
} \
} while (0)
/**