summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuis Soares <luis.soares@sun.com>2010-03-08 23:55:19 +0000
committerLuis Soares <luis.soares@sun.com>2010-03-08 23:55:19 +0000
commit17a30e02af67307de39ea50d8376163e7a0b7207 (patch)
tree0bf0bead1caec8c1798bdb7bfb5675433db040f2
parent25a9f5e0941b879f1558579d4718ea5c747c7d12 (diff)
parentf0b38904aaca492acb408aaf571758d9a8f9b83d (diff)
downloadmariadb-git-17a30e02af67307de39ea50d8376163e7a0b7207.tar.gz
Automerge: BUG 48993 bundle from bug report --> mysql-5.1-bugteam.
-rw-r--r--client/mysqlbinlog.cc11
-rw-r--r--mysql-test/t/mysqlbinlog.test24
-rw-r--r--sql/log_event.cc2
3 files changed, 33 insertions, 4 deletions
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 8b78fc252fe..ada22f19a65 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -832,7 +832,11 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
print_event_info->common_header_len=
glob_description_event->common_header_len;
ev->print(result_file, print_event_info);
- ev->temp_buf= 0; // as the event ref is zeroed
+ if (!remote_opt)
+ ev->free_temp_buf(); // free memory allocated in dump_local_log_entries
+ else
+ // disassociate but not free dump_remote_log_entries time memory
+ ev->temp_buf= 0;
/*
We don't want this event to be deleted now, so let's hide it (I
(Guilhem) should later see if this triggers a non-serious Valgrind
@@ -1362,7 +1366,6 @@ static int parse_args(int *argc, char*** argv)
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)
@@ -2019,8 +2022,10 @@ int main(int argc, char** argv)
my_init_time(); // for time functions
+ if (load_defaults("my", load_default_groups, &argc, &argv))
+ exit(1);
+ defaults_argv= argv;
parse_args(&argc, (char***)&argv);
- defaults_argv=argv;
if (!argc)
{
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
index 687ad62b17c..0d3f0a8a7c4 100644
--- a/mysql-test/t/mysqlbinlog.test
+++ b/mysql-test/t/mysqlbinlog.test
@@ -443,3 +443,27 @@ FLUSH LOGS;
--echo End of 5.0 tests
--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 $MYSQLD_DATADIR/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;
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 7de986b325b..8e8e7bd4338 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -9478,7 +9478,7 @@ Incident_log_event::write_data_body(IO_CACHE *file)
they will always be printed for the first event.
*/
st_print_event_info::st_print_event_info()
- :flags2_inited(0), sql_mode_inited(0),
+ :flags2_inited(0), sql_mode_inited(0), sql_mode(0),
auto_increment_increment(0),auto_increment_offset(0), charset_inited(0),
lc_time_names_number(~0),
charset_database_number(ILLEGAL_CHARSET_INFO_NUMBER),