diff options
Diffstat (limited to 'storage/connect/ha_connect.h')
-rw-r--r-- | storage/connect/ha_connect.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/storage/connect/ha_connect.h b/storage/connect/ha_connect.h index 090f8343e1e..71ceb7974ba 100644 --- a/storage/connect/ha_connect.h +++ b/storage/connect/ha_connect.h @@ -555,3 +555,25 @@ public: #if defined(JAVA_SUPPORT) || defined(CMGO_SUPPORT) bool MongoEnabled(void); #endif // JAVA_SUPPORT || CMGO_SUPPORT + +/* This is a hack for ASAN + * Libraries such as libxml2 and libodbc do not like being unloaded before + * exit and will show as a leak in ASAN with no stack trace (as the plugin + * has been unloaded from memory). + * + * The below is designed to trick the compiler into adding a "UNIQUE" symbol + * which can be seen using: + * readelf -s storage/connect/ha_connect.so | grep UNIQUE + * + * Having this symbol means that the plugin remains in memory after dlclose() + * has been called. Thereby letting the libraries clean up properly. + */ +#if defined(__SANITIZE_ADDRESS__) +__attribute__((__used__)) +inline int dummy(void) +{ + static int d; + d++; + return d; +} +#endif |