From c6251e36fc8e8704fd2c6dd88e5ea7dd2d4bcce6 Mon Sep 17 00:00:00 2001 From: sjaakola Date: Thu, 10 Aug 2017 14:04:55 +0300 Subject: [PATCH] MW-399 Freeing wsrep_status_vars, before provider is released. This is needed to clear THD::wsrep_status_vars reference, which would otherwise remain to point to status variable array, which is no more effective. --- sql/wsrep_var.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc index 20091a3893e..8cb80a7c13a 100644 --- a/sql/wsrep_var.cc +++ b/sql/wsrep_var.cc @@ -300,8 +300,15 @@ bool wsrep_provider_update (sys_var *self, THD* thd, enum_var_type type) if (wsrep_inited == 1) wsrep_deinit(false); - char* tmp= strdup(wsrep_provider); // wsrep_init() rewrites provider + char* tmp= strdup(wsrep_provider); // wsrep_init() rewrites provider //when fails + + /* provider status variables are allocated in provider library + and need to freed here, otherwise a dangling reference to + wsrep_status_vars would remain in THD + */ + wsrep_free_status(thd); + if (wsrep_init()) { my_error(ER_CANT_OPEN_LIBRARY, MYF(0), tmp);