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.
This commit is contained in:
Vladislav Vaintroub 2013-07-29 16:03:41 +02:00
parent 9e13011efb
commit 3ef0157daa
4 changed files with 9 additions and 0 deletions

View File

@ -1642,6 +1642,7 @@ void _db_end_()
cs->stack= &init_settings;
FreeState(cs, 0);
init_done= 0;
}

View File

@ -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;
}

View File

@ -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)

View File

@ -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