From 07867ec373b98d6c0d3048983091ba4c49231196 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 26 Dec 2007 23:44:24 +0100 Subject: Fix some memleaks (This used to be commit 78b0b66cbac349625257260d2e45d918e0c93617) --- source3/lib/debug.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'source3/lib/debug.c') diff --git a/source3/lib/debug.c b/source3/lib/debug.c index 87ec9ed8f5..9ea2dc151a 100644 --- a/source3/lib/debug.c +++ b/source3/lib/debug.c @@ -785,13 +785,13 @@ void check_log_size( void ) (void)x_vfprintf( dbf, format_str, ap ); va_end( ap ); errno = old_errno; - return( 0 ); + goto done; } /* prevent recursion by checking if reopen_logs() has temporaily set the debugf string to NULL */ if( debugf == NULL) - return( 0 ); + goto done; #ifdef WITH_SYSLOG if( !lp_syslog_only() ) @@ -806,7 +806,7 @@ void check_log_size( void ) x_setbuf( dbf, NULL ); } else { errno = old_errno; - return(0); + goto done; } } } @@ -855,10 +855,11 @@ void check_log_size( void ) (void)x_fflush( dbf ); } - errno = old_errno; - + done: TALLOC_FREE(tmp_debug_ctx); + errno = old_errno; + return( 0 ); } -- cgit From 68ec31427735e3d127544e52d4107d1e97eeeada Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 12:41:18 +0100 Subject: In gfree_debugsyms() free the format_bufr as well. Guenther (This used to be commit 48f09ca376f9fc7923309f3466e5d72f7c21a56f) --- source3/lib/debug.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source3/lib/debug.c') diff --git a/source3/lib/debug.c b/source3/lib/debug.c index 9ea2dc151a..6c1bfea04f 100644 --- a/source3/lib/debug.c +++ b/source3/lib/debug.c @@ -199,6 +199,8 @@ void gfree_debugsyms(void) if ( DEBUGLEVEL_CLASS_ISSET != &debug_all_class_isset_hack ) SAFE_FREE( DEBUGLEVEL_CLASS_ISSET ); + + SAFE_FREE(format_bufr); } /**************************************************************************** -- cgit From 587cf54c61c9f1f7bcae431a82035fd942716c32 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 23 Jan 2008 11:04:10 +0100 Subject: strtok -> strtok_r (This used to be commit fd34ce437057bb34cdc37f4b066e424000d36789) --- source3/lib/debug.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source3/lib/debug.c') diff --git a/source3/lib/debug.c b/source3/lib/debug.c index 6c1bfea04f..51bb0d7541 100644 --- a/source3/lib/debug.c +++ b/source3/lib/debug.c @@ -429,8 +429,9 @@ static bool debug_parse_params(char **params) /* Fill in new debug class levels */ for (; i < debug_num_classes && params[i]; i++) { - if ((class_name=strtok(params[i],":")) && - (class_level=strtok(NULL, "\0")) && + char *saveptr; + if ((class_name = strtok_r(params[i],":", &saveptr)) && + (class_level = strtok_r(NULL, "\0", &saveptr)) && ((ndx = debug_lookup_classname(class_name)) != -1)) { DEBUGLEVEL_CLASS[ndx] = atoi(class_level); DEBUGLEVEL_CLASS_ISSET[ndx] = True; -- cgit