summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-08-09 18:34:28 +1000
committerAndrew Bartlett <abartlet@samba.org>2012-08-09 20:14:22 +1000
commit434bed75c43d3d7854bd9433913448810d3ff511 (patch)
tree3d64db0d5e09ab554381aa0dc222df121d3bd1fb /source3
parent299fc7522858e2d7ee6c54310a4e157c8142c74f (diff)
downloadsamba-434bed75c43d3d7854bd9433913448810d3ff511.tar.gz
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
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/events.c10
1 files 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)