Samba 3.5.8 leaks memory in DEBUG (dbghdrclass)

Dina_Fine at Dina_Fine at
Wed Nov 30 06:12:21 MST 2011


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.

Dina Fine
Engineering Team Leader
Dell | IDC
office +972 97698825,  fax +972 97698889
dina_fine at<mailto:dina_fine at>
Dell IDC. 89 Medinat Hayehudim St, Tower E, Herzeliya 46141, Israel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smb_patch_3.5.8_memory_leak
Type: application/octet-stream
Size: 1130 bytes
Desc: smb_patch_3.5.8_memory_leak
URL: <>

More information about the samba-technical mailing list