From: Andrew Bartlett Date: Thu, 9 Aug 2012 08:34:28 +0000 (+1000) Subject: s3-events: Do not vasprintf() the tevent debug messages that will not be shown X-Git-Tag: ldb-1.1.10~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=434bed75c43d3d7854bd9433913448810d3ff511;p=thirdparty%2Fsamba.git 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 --- 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)