diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc index 9c5c84c25955..858f7d486c99 100644 --- a/storage/innobase/dict/dict0load.cc +++ b/storage/innobase/dict/dict0load.cc @@ -63,6 +63,7 @@ this program; if not, write to the Free Software Foundation, Inc., #include "mysql_version.h" #include "page0page.h" #include "rem0cmp.h" +#include "scope_guard.h" #include "srv0srv.h" #include "srv0start.h" @@ -1556,6 +1557,8 @@ static inline std::pair dict_check_sys_tables(bool validate) { DBUG_TRACE; + auto guard = create_scope_guard([&pcur]() { pcur.close(); }); + ut_ad(dict_sys_mutex_own()); mtr_start(&mtr);