s4-events: Do not vasprintf() the tevent debug messages that will not be shown
authorAndrew Bartlett <abartlet@samba.org>
Thu, 9 Aug 2012 08:34:48 +0000 (18:34 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 9 Aug 2012 10:14:22 +0000 (20:14 +1000)
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

index 469ed72ee7eb5b4844ee258dff52ae8108cbf8ec..6770dd07af859f33a0ffa6ef3956c3d00ec6c9b4 100644 (file)
@@ -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);
+       }
 }
 
 /*