From abe4c14ae93f0d8c97bd97b5674a5b00ddfc9b1f Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 12 Feb 2008 18:21:17 +0100 Subject: [PATCH] Various fixes to fix memory leaks after merging replication tree with main. sql/sql_binlog.cc: Adding code to free memory after execution of BINLOG statement. It caused a memory leak in the case that the execution failed for any reason. sql/sql_class.cc: Since rli_fake is checked for NULL at various occations to mean that no rli_fake is assigned, NULL is assigned to rli_fake after deleting the instance. --- sql/sql_binlog.cc | 1 + sql/sql_class.cc | 3 +++ 2 files changed, 4 insertions(+) diff --git a/sql/sql_binlog.cc b/sql/sql_binlog.cc index cff4ceeccf9..462806ab10d 100644 --- a/sql/sql_binlog.cc +++ b/sql/sql_binlog.cc @@ -234,6 +234,7 @@ void mysql_client_binlog_statement(THD* thd) send_ok(thd); end: + thd->rli_fake->clear_tables_to_lock(); my_free(buf, MYF(MY_ALLOW_ZERO_PTR)); DBUG_VOID_RETURN; } diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 5180cafc774..044ea70e994 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -870,7 +870,10 @@ THD::~THD() #endif #ifndef EMBEDDED_LIBRARY if (rli_fake) + { delete rli_fake; + rli_fake= NULL; + } #endif free_root(&main_mem_root, MYF(0));