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);