Commit cb28cf8d authored by unknown's avatar unknown

Fix a Valgrind leak error report for not freed binlog injector singleton.


sql/mysqld.cc:
  Free the binlog injector singleton during shutdown.
sql/rpl_injector.cc:
  Add free_instance() method.
sql/rpl_injector.h:
  Add free_instance() method.
parent 78deb348
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
#include "ha_myisam.h" #include "ha_myisam.h"
#ifdef HAVE_ROW_BASED_REPLICATION
#include "rpl_injector.h"
#endif
#ifdef WITH_INNOBASE_STORAGE_ENGINE #ifdef WITH_INNOBASE_STORAGE_ENGINE
#define OPT_INNODB_DEFAULT 1 #define OPT_INNODB_DEFAULT 1
#else #else
...@@ -1183,6 +1187,9 @@ void clean_up(bool print_message) ...@@ -1183,6 +1187,9 @@ void clean_up(bool print_message)
what they have that is dependent on the binlog what they have that is dependent on the binlog
*/ */
ha_binlog_end(current_thd); ha_binlog_end(current_thd);
#ifdef HAVE_ROW_BASED_REPLICATION
injector::free_instance();
#endif
mysql_bin_log.cleanup(); mysql_bin_log.cleanup();
#ifdef HAVE_REPLICATION #ifdef HAVE_REPLICATION
......
...@@ -155,6 +155,16 @@ injector *injector::instance() ...@@ -155,6 +155,16 @@ injector *injector::instance()
return s_injector; return s_injector;
} }
void injector::free_instance()
{
injector *inj = s_injector;
if (inj != 0)
{
s_injector= 0;
delete inj;
}
}
injector::transaction injector::new_trans(THD *thd) injector::transaction injector::new_trans(THD *thd)
......
...@@ -59,6 +59,11 @@ class injector ...@@ -59,6 +59,11 @@ class injector
*/ */
static injector *instance(); static injector *instance();
/*
Delete the singleton instance (if allocated). Used during server shutdown.
*/
static void free_instance();
/* /*
A transaction where rows can be added. A transaction where rows can be added.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment