diff options
author | Andrew Bartlett <abartlet@samba.org> | 2012-08-09 18:34:28 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2012-08-09 20:14:22 +1000 |
commit | 434bed75c43d3d7854bd9433913448810d3ff511 (patch) | |
tree | 3d64db0d5e09ab554381aa0dc222df121d3bd1fb | |
parent | 299fc7522858e2d7ee6c54310a4e157c8142c74f (diff) | |
download | samba-434bed75c43d3d7854bd9433913448810d3ff511.tar.gz samba-434bed75c43d3d7854bd9433913448810d3ff511.tar.bz2 samba-434bed75c43d3d7854bd9433913448810d3ff511.zip |
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
-rw-r--r-- | source3/lib/events.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source3/lib/events.c b/source3/lib/events.c index 72fd40ef59..cafe598ca0 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) |