List:Commits« Previous MessageNext Message »
From:He Zhenxing Date:April 15 2009 3:35am
Subject:bzr commit into mysql-6.0-rpl branch (zhenxing.he:2841) Bug#38468
View as plain text  
#At file:///media/sdb2/hezx/work/mysql/bzrwork/b38468/6.0-rpl/ based on revid:alfranio.correia@stripped

 2841 He Zhenxing	2009-04-15
      BUG#38468 Memory leak detected when using mysqlbinlog utility
      
      There were two memory leaks in mysqlbinlog command, one was already
      fixed by previous patches, another one was that defaults_argv was
      set to the value of argv after parse_args, in which called
      handle_options after calling load_defaults and changed the value
      of argv, and caused the memory allocated for defaults arguments
      not freed.
      
      Fixed the problem by setting defaults_argv right after calling
      load_defaults.
     @ client/mysqlbinlog.cc
        Move load_defaults out of parse_args to main, set defaults_argv right after load_defaults

    M  client/mysqlbinlog.cc
    M  mysql-test/t/mysqlbinlog.test
=== modified file 'client/mysqlbinlog.cc'
--- a/client/mysqlbinlog.cc	2008-12-24 10:48:24 +0000
+++ b/client/mysqlbinlog.cc	2009-04-15 03:34:47 +0000
@@ -1302,7 +1302,6 @@ static int parse_args(int *argc, char***
   int ho_error;
 
   result_file = stdout;
-  load_defaults("my",load_default_groups,argc,argv);
   if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
     exit(ho_error);
   if (debug_info_flag)
@@ -1956,8 +1955,9 @@ int main(int argc, char** argv)
 
   my_init_time(); // for time functions
 
+  load_defaults("my", load_default_groups, &argc, &argv);
+  defaults_argv= argv;
   parse_args(&argc, (char***)&argv);
-  defaults_argv=argv;
 
   if (!argc)
   {

=== modified file 'mysql-test/t/mysqlbinlog.test'
--- a/mysql-test/t/mysqlbinlog.test	2009-03-06 20:33:52 +0000
+++ b/mysql-test/t/mysqlbinlog.test	2009-04-15 03:34:47 +0000
@@ -368,3 +368,27 @@ eval SET @@global.server_id= $save_serve
 --remove_file $binlog_file
 
 --echo End of 5.1 tests
+
+#
+# BUG#38468 Memory leak detected when using mysqlbinlog utility;
+#
+disable_query_log;
+RESET MASTER;
+CREATE TABLE t1 SELECT 1;
+FLUSH LOGS;
+DROP TABLE t1;
+enable_query_log;
+
+# Write an empty file for comparison
+write_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn.empty;
+EOF
+
+# Before fix of BUG#38468, this would generate some warnings
+--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000001 >/dev/null 2> $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn
+
+# Make sure the command above does not generate any error or warnings
+diff_files $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn.empty;
+
+# Cleanup for this part of test
+remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn.empty;
+remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn;


Attachment: [text/bzr-bundle] bzr/zhenxing.he@sun.com-20090415033447-t0dciqke37pm0vpc.bundle
Thread
bzr commit into mysql-6.0-rpl branch (zhenxing.he:2841) Bug#38468He Zhenxing15 Apr