From 10d607279e5f7cf6b453f574f47060ad8d24c2f7 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 26 Feb 2007 17:44:55 +0100 Subject: BUG#26634 (Valgrind failure in tree: memory loss for memory allocated in rpl_utility.h): Adding code to release allocated memory when tables_to_lock list is cleared. sql/log_event.cc: Using RPL_TABLE_LIST instead of TABLE_LIST for tables_to_lock. sql/rpl_rli.cc: Moving st_relay_log_info::clear_tables_to_lock() into rpl_rli.cc. Adding code to release memory allocated for saved table definition. sql/rpl_rli.h: Moving st_relay_log_info::clear_tables_to_lock() into rpl_rli.cc. Using RPL_TABLE_LIST instead of TABLE_LIST for tables_to_lock. sql/rpl_utility.h: Adding forward declarations. Adding boolean to tell if tabledef is valid. --- sql/rpl_rli.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'sql/rpl_rli.cc') diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index 6a7b22bf23d..8a051195dba 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -18,6 +18,7 @@ #include "rpl_rli.h" #include // For MY_STAT #include "sql_repl.h" // For check_binlog_magic +#include "rpl_utility.h" static int count_relay_log_space(RELAY_LOG_INFO* rli); @@ -1108,4 +1109,23 @@ void st_relay_log_info::cleanup_context(THD *thd, bool error) unsafe_to_stop_at= 0; DBUG_VOID_RETURN; } + +void st_relay_log_info::clear_tables_to_lock() +{ + while (tables_to_lock) + { + gptr to_free= reinterpret_cast(tables_to_lock); + if (tables_to_lock->m_tabledef_valid) + { + tables_to_lock->m_tabledef.table_def::~table_def(); + tables_to_lock->m_tabledef_valid= FALSE; + } + tables_to_lock= + static_cast(tables_to_lock->next_global); + tables_to_lock_count--; + my_free(to_free, MYF(MY_WME)); + } + DBUG_ASSERT(tables_to_lock == NULL && tables_to_lock_count == 0); +} + #endif -- cgit v1.2.1