From 7e562cf3eb8d8aabf9b5d62a92e67221e4f07e3a Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 9 Aug 2012 18:34:48 +1000 Subject: s4-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. Andrew Bartlett --- source4/lib/events/tevent_s4.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/events/tevent_s4.c b/source4/lib/events/tevent_s4.c index 469ed72ee7..6770dd07af 100644 --- a/source4/lib/events/tevent_s4.c +++ b/source4/lib/events/tevent_s4.c @@ -46,10 +46,12 @@ static void ev_wrap_debug(void *context, enum tevent_debug_level level, break; }; - vasprintf(&s, fmt, ap); - if (!s) return; - DEBUG(samba_level, ("tevent: %s", s)); - free(s); + if (CHECK_DEBUGLVL(samba_level)) { + vasprintf(&s, fmt, ap); + if (!s) return; + DEBUG(samba_level, ("tevent: %s", s)); + free(s); + } } /* -- cgit