diff options
author | Georgi Kodinov <joro@sun.com> | 2010-04-16 10:30:53 +0300 |
---|---|---|
committer | Georgi Kodinov <joro@sun.com> | 2010-04-16 10:30:53 +0300 |
commit | 16fadb10b5d2a9328b5caa85963a3d851b35cef4 (patch) | |
tree | c7fdf45e1aaf6ac06c19494c1e92d2b217c65b15 /dbug/dbug.c | |
parent | 8fa9a5861bb0bf2a077e5b596456081da0f15dbe (diff) | |
download | mariadb-git-16fadb10b5d2a9328b5caa85963a3d851b35cef4.tar.gz |
Bug #52629: memory leak from sys_var_thd_dbug in binlog.binlog_write_error
When re-setting (SET GLOBAL debug='') the GLOBAL debug settings the
server was not freeing the data elements from the top (initial) frame
before setting them to 0 without freeing the underlying memory. As these
are global settings there's a chance that something is there already.
Fixed by :
1. making sure the allocated data are cleaned up before re-setting them
while parsing a debug string
2. making sure the stuff allocated in the global settings is freed on
shutdown.
Diffstat (limited to 'dbug/dbug.c')
-rw-r--r-- | dbug/dbug.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/dbug/dbug.c b/dbug/dbug.c index baf080f5e27..30ad6c2c6d1 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -455,6 +455,13 @@ static void DbugParse(CODE_STATE *cs, const char *control) rel= control[0] == '+' || control[0] == '-'; if ((!rel || (!stack->out_file && !stack->next))) { + /* + We need to free what's already in init_settings, because unlike + the thread related stack frames there's a chance that something + is in these variables already. + */ + if (stack == &init_settings) + FreeState(cs, stack, 0); stack->flags= 0; stack->delay= 0; stack->maxdepth= 0; @@ -1510,7 +1517,10 @@ void _db_end_() while ((discard= cs->stack)) { if (discard == &init_settings) + { + FreeState (cs, discard, 0); break; + } cs->stack= discard->next; FreeState(cs, discard, 1); } |