diff options
author | Vladislav Vaintroub <wlad@montyprogram.com> | 2013-07-29 16:03:41 +0200 |
---|---|---|
committer | Vladislav Vaintroub <wlad@montyprogram.com> | 2013-07-29 16:03:41 +0200 |
commit | 3ef0157daa3593d2003e14fac3a7a8a249e9c048 (patch) | |
tree | 89743bedcf041c1cb81a72ca2021da2a7f4c46c4 | |
parent | 9e13011efb137728e14a89d936616a14ebee8f59 (diff) | |
download | mariadb-git-3ef0157daa3593d2003e14fac3a7a8a249e9c048.tar.gz |
MDEV-4815 - allow multiple mysql_server_init() / mysql_server_end() in the same process, for embedded library.
- Reset static variables that are used to signal "init done" for DBUG, in dbug_end()
- Set string server variables to NULL after memory for the value is freed - avoids double free()
- fix DBUG_ASSERTs that happened during reinitialization.
-rw-r--r-- | dbug/dbug.c | 1 | ||||
-rw-r--r-- | mysys/waiting_threads.c | 1 | ||||
-rw-r--r-- | sql/sys_vars.h | 3 | ||||
-rw-r--r-- | storage/xtradb/os/os0file.c | 4 |
4 files changed, 9 insertions, 0 deletions
diff --git a/dbug/dbug.c b/dbug/dbug.c index b285b32fa17..db5ecb7b95e 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -1642,6 +1642,7 @@ void _db_end_() cs->stack= &init_settings; FreeState(cs, 0); + init_done= 0; } diff --git a/mysys/waiting_threads.c b/mysys/waiting_threads.c index 0a9474e68b4..c861dcc738c 100644 --- a/mysys/waiting_threads.c +++ b/mysys/waiting_threads.c @@ -475,6 +475,7 @@ void wt_end() my_atomic_rwlock_destroy(&cycle_stats_lock); my_atomic_rwlock_destroy(&success_stats_lock); my_atomic_rwlock_destroy(&wait_stats_lock); + reshash.alloc.constructor= NULL; wt_init_done= 0; DBUG_VOID_RETURN; } diff --git a/sql/sys_vars.h b/sql/sys_vars.h index 8345a2836dd..b7be81afd73 100644 --- a/sql/sys_vars.h +++ b/sql/sys_vars.h @@ -427,7 +427,10 @@ public: void cleanup() { if (flags & ALLOCATED) + { my_free(global_var(char*)); + global_var(char *)= NULL; + } flags&= ~ALLOCATED; } static bool do_string_check(THD *thd, set_var *var, CHARSET_INFO *charset) diff --git a/storage/xtradb/os/os0file.c b/storage/xtradb/os/os0file.c index ae6ba05c9f6..5beed447c91 100644 --- a/storage/xtradb/os/os0file.c +++ b/storage/xtradb/os/os0file.c @@ -3773,6 +3773,10 @@ os_aio_free(void) ut_free(os_aio_segment_wait_events); os_aio_segment_wait_events = 0; os_aio_n_segments = 0; +#ifdef _WIN32 + completion_port = 0; + read_completion_port = 0; +#endif } #ifdef WIN_ASYNC_IO |