diff options
author | unknown <mats@romeo.(none)> | 2007-02-26 17:44:55 +0100 |
---|---|---|
committer | unknown <mats@romeo.(none)> | 2007-02-26 17:44:55 +0100 |
commit | 236bb807330446e23733a895b937073cf325fb7e (patch) | |
tree | ae16b56efa7b45a7beb603a53d024a4de87db6af /sql/rpl_rli.cc | |
parent | acc120071ce87c2456bb0db08d96e7714c3a1604 (diff) | |
download | mariadb-git-236bb807330446e23733a895b937073cf325fb7e.tar.gz |
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.
Diffstat (limited to 'sql/rpl_rli.cc')
-rw-r--r-- | sql/rpl_rli.cc | 20 |
1 files changed, 20 insertions, 0 deletions
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 <my_dir.h> // 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<gptr>(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<RPL_TABLE_LIST*>(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 |