MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:April 16 2010 7:32am
Subject:bzr commit into mysql-5.1-bugteam branch (joro:3455) Bug#52629
View as plain text  
#At file:///home/kgeorge/mysql/work/B52629-5.1-bugteam/ based on revid:luis.soares@stripped

 3455 Georgi Kodinov	2010-04-16
      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.

    modified:
      dbug/dbug.c
      mysql-test/r/variables_debug.result
      mysql-test/t/variables_debug.test
=== modified file 'dbug/dbug.c'
--- a/dbug/dbug.c	2009-07-16 12:43:17 +0000
+++ b/dbug/dbug.c	2010-04-16 07:30:53 +0000
@@ -455,6 +455,13 @@ static void DbugParse(CODE_STATE *cs, co
   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);
   }

=== modified file 'mysql-test/r/variables_debug.result'
--- a/mysql-test/r/variables_debug.result	2008-02-26 15:03:59 +0000
+++ b/mysql-test/r/variables_debug.result	2010-04-16 07:30:53 +0000
@@ -10,3 +10,16 @@ set debug= '-P';
 select @@debug;
 @@debug
 T
+#
+# Bug #52629: memory leak from sys_var_thd_dbug in 
+#  binlog.binlog_write_error
+#
+SET GLOBAL debug='d,injecting_fault_writing';
+SELECT @@global.debug;
+@@global.debug
+d,injecting_fault_writing
+SET GLOBAL debug='';
+SELECT @@global.debug;
+@@global.debug
+
+End of 5.1 tests

=== modified file 'mysql-test/t/variables_debug.test'
--- a/mysql-test/t/variables_debug.test	2008-02-26 15:03:59 +0000
+++ b/mysql-test/t/variables_debug.test	2010-04-16 07:30:53 +0000
@@ -10,3 +10,16 @@ set debug= '+P';
 select @@debug;
 set debug= '-P';
 select @@debug;
+
+--echo #
+--echo # Bug #52629: memory leak from sys_var_thd_dbug in 
+--echo #  binlog.binlog_write_error
+--echo #
+
+SET GLOBAL debug='d,injecting_fault_writing';
+SELECT @@global.debug;
+SET GLOBAL debug='';
+SELECT @@global.debug;
+
+
+--echo End of 5.1 tests


Attachment: [text/bzr-bundle] bzr/joro@sun.com-20100416073053-a2d4rkx2i7a2dhw0.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (joro:3455) Bug#52629Georgi Kodinov16 Apr