diff --git a/storage/innobase/include/read0types.h b/storage/innobase/include/read0types.h index 0ebdb6a4761..ff282aa1f3f 100644 --- a/storage/innobase/include/read0types.h +++ b/storage/innobase/include/read0types.h @@ -276,5 +276,22 @@ public: to->append(*this); mutex_exit(&m_mutex); } + + + /** + Unpoison the memory for innodb_monitor_set_option; + It is operating also on the freed transaction objects. + Declare the contents as initialized for Valgrind; + We checked that it was initialized in trx_pools->mem_free(trx). + */ + void mem_valid() const + { +#ifdef __SANITIZE_ADDRESS__ + MEM_UNDEFINED(&m_mutex, sizeof m_mutex); +#endif +#ifdef HAVE_valgrind + UNIV_MEM_VALID(&m_mutex, sizeof m_mutex); +#endif + } }; #endif diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index 79778c0d02d..85e4ec54cf6 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -457,6 +457,7 @@ void trx_free(trx_t*& trx) /* Declare the contents as initialized for Valgrind; we checked that it was initialized in trx_pools->mem_free(trx). */ UNIV_MEM_VALID(&trx->mutex, sizeof trx->mutex); + trx->read_view.mem_valid(); trx = NULL; }