diff --git a/components/libminchassis/dynamic_loader_scheme_file.cc b/components/libminchassis/dynamic_loader_scheme_file.cc index 2083559c6d75..1f77c4556119 100644 --- a/components/libminchassis/dynamic_loader_scheme_file.cc +++ b/components/libminchassis/dynamic_loader_scheme_file.cc @@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include +#include "my_config.h" #ifndef _WIN32 #include #endif @@ -215,7 +216,12 @@ DEFINE_BOOL_METHOD(mysql_dynamic_loader_scheme_file_imp::unload, mysql_unload_plugin(it->first.c_str()); /* Close library and delete entry from libraries list. */ +#if !defined(HAVE_VALGRIND) && !defined(HAVE_ASAN) + /* + * Avoid closing components under ASAN / Valgrind in order to get + * meaningfull leak report */ dlclose(it->second); +#endif object_files_list.erase(it); return false; } catch (...) { diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 48c2ffc00c1c..66df4288ff69 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -622,7 +622,12 @@ static inline void free_plugin_mem(st_plugin_dl *p) { PSI_SYSTEM_CALL(unload_plugin) (std::string(p->dl.str, p->dl.length).c_str()); #endif +#if !defined(HAVE_VALGRIND) && !defined(HAVE_ASAN) + /* + * Avoid closing components under ASAN / Valgrind in order to get + * meaningfull leak report */ dlclose(p->handle); +#endif } my_free(p->dl.str); if (p->version != MYSQL_PLUGIN_INTERFACE_VERSION) my_free(p->plugins);