Commit 3ef0157d authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-4815 - allow multiple mysql_server_init() / mysql_server_end() in the...

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.
parent 9e13011e
......@@ -1642,6 +1642,7 @@ void _db_end_()
cs->stack= &init_settings;
FreeState(cs, 0);
init_done= 0;
}
......
......@@ -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;
}
......
......@@ -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)
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment