Samba 3.5.8 leaks memory in DEBUG (dbghdrclass)

Jeremy Allison jra at
Wed Nov 30 13:05:42 MST 2011

On Wed, Nov 30, 2011 at 01:12:21PM +0000, Dina_Fine at wrote:
> Hello
> We noticed a big memory leak when running different load testing tools especially when debug level was increased.
> The analyze led us to dbghdrclass function (/vobs/vendor/smb/source3/lib/debug.c), the following code:
> if( lp_debug_prefix_timestamp() ) {
>                             (void)Debug1( "[%s, %2d%s] ",
>                             current_timestring(talloc_tos(),  lp_debug_hires_timestamp()), level, header_str);
>                         } else {
>                             (void)Debug1( "[%s, %2d%s] %s(%s)\n",
>                                     current_timestring(talloc_tos(),   lp_debug_hires_timestamp()), level, header_str, location, func );
> }
> current_timestring returns dynamically allocated memory which no-one frees.
> The patch is attached.
> Perhaps you are already aware of this bug and fixed it, I didn't check latest releases.

Interesting. What load testing tools are you using so we
can see if a talloc_tos() leak is happening ? (As Volker
already pointed out, this really shouldn't happen with
normal debugs within a 'standard' main loop). Do you
know what specific debug you're seeing that causes it ?


More information about the samba-technical mailing list