From 434bed75c43d3d7854bd9433913448810d3ff511 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 9 Aug 2012 18:34:28 +1000 Subject: [PATCH] s3-events: Do not vasprintf() the tevent debug messages that will not be shown This malloc() and free() actually shows up quite high on a call profile of provision of the AD DC (and this is the matching patch for source3). Andrew Bartlett --- source3/lib/events.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source3/lib/events.c b/source3/lib/events.c index 72fd40ef598..cafe598ca09 100644 --- a/source3/lib/events.c +++ b/source3/lib/events.c @@ -434,11 +434,13 @@ static void s3_event_debug(void *context, enum tevent_debug_level level, break; }; - if (vasprintf(&s, fmt, ap) == -1) { - return; + if (CHECK_DEBUGLVL(samba_level)) { + if (vasprintf(&s, fmt, ap) == -1) { + return; + } + DEBUG(samba_level, ("s3_event: %s", s)); + free(s); } - DEBUG(samba_level, ("s3_event: %s", s)); - free(s); } struct tevent_context *s3_tevent_context_init(TALLOC_CTX *mem_ctx) -- 2.11.4.GIT