Skip to content

Commit 1be2079

Browse files
author
Georgios Psaropoulos
committed
Bug#35658656 Memory leaks hidden by global heap
The HW global heap no longer garbage collects leaking allocations; these allocations must be properly handled from now on. Changes: - Call the destructor on the non-trivial classes RapidColumn and HtEntry before freeing memory. - Fix the setters of ConfigurationValueExternalJSON to delete the old values. - Add RTLD_NODELETE to dlopen in sql_plugin.cc when building with HAVE_ASAN or HAVE_LSAN. - In ctests, reset the configuration before deleting the Heap. - Configuration::getObjStoreParam returns a rapid::util::UniquePtr. Change-Id: I8e4ddff653a2f226d17ea6f37d0c31d647da0352
1 parent e9b437d commit 1be2079

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

sql/sql_plugin.cc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,15 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report,
687687
plugin_dl.ref_count = 1;
688688
/* Open new dll handle */
689689
mysql_mutex_assert_owner(&LOCK_plugin);
690-
if (!(plugin_dl.handle = dlopen(dlpath, RTLD_NOW))) {
690+
#if defined(HAVE_ASAN) || defined(HAVE_LSAN)
691+
// Do not unload the shared object during dlclose().
692+
// LeakSanitizer needs this in order to match entries in lsan.supp
693+
plugin_dl.handle = dlopen(dlpath, RTLD_NOW | RTLD_NODELETE);
694+
#else
695+
plugin_dl.handle = dlopen(dlpath, RTLD_NOW);
696+
#endif
697+
698+
if (plugin_dl.handle == nullptr) {
691699
const char *errmsg;
692700
const int error_number = dlopen_errno;
693701
/*

0 commit comments

Comments
 (0)