diff options
author | Andrew Bartlett <abartlet@samba.org> | 2012-08-09 19:41:05 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2012-08-09 13:51:06 +0200 |
commit | 11d60d13dc54ff154b2a7bb53e326ed2180d473c (patch) | |
tree | eb093355a8ee4630433648d8eb5138fbfeda3158 /lib/ldb-samba | |
parent | 73f0cb5278e714740d0de75e6b0d0bf4c815491a (diff) | |
download | samba-11d60d13dc54ff154b2a7bb53e326ed2180d473c.tar.gz samba-11d60d13dc54ff154b2a7bb53e326ed2180d473c.tar.bz2 samba-11d60d13dc54ff154b2a7bb53e326ed2180d473c.zip |
s4-ldb_wrap: Do not vasprintf() the ldb 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
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Aug 9 13:51:06 CEST 2012 on sn-devel-104
Diffstat (limited to 'lib/ldb-samba')
-rw-r--r-- | lib/ldb-samba/ldb_wrap.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/ldb-samba/ldb_wrap.c b/lib/ldb-samba/ldb_wrap.c index 83a06743be..028bd6f58d 100644 --- a/lib/ldb-samba/ldb_wrap.c +++ b/lib/ldb-samba/ldb_wrap.c @@ -47,7 +47,6 @@ static void ldb_wrap_debug(void *context, enum ldb_debug_level level, const char *fmt, va_list ap) { int samba_level = -1; - char *s = NULL; switch (level) { case LDB_DEBUG_FATAL: samba_level = 0; @@ -63,10 +62,13 @@ static void ldb_wrap_debug(void *context, enum ldb_debug_level level, break; }; - vasprintf(&s, fmt, ap); - if (!s) return; - DEBUG(samba_level, ("ldb: %s\n", s)); - free(s); + if (CHECK_DEBUGLVL(samba_level)) { + char *s = NULL; + vasprintf(&s, fmt, ap); + if (!s) return; + DEBUG(samba_level, ("ldb: %s\n", s)); + free(s); + } } |