summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorIgor Solodovnikov <igor.solodovnikov@oracle.com>2014-04-23 12:46:00 +0300
committerIgor Solodovnikov <igor.solodovnikov@oracle.com>2014-04-23 12:46:00 +0300
commitb264c3e18d82d6dad2552ae2e4386657264bb756 (patch)
tree23ceb667072b8d92ed3dd9b02194429d4cf07242 /mysys
parent9688cbc25053584e7aaaa150e0e3358d2f2ae428 (diff)
downloadmariadb-git-b264c3e18d82d6dad2552ae2e4386657264bb756.tar.gz
Bug #17514920 MYSQL_THREAD_INIT() CALL WITHOUT MYSQL_INIT() IS CRASHING IN WINDOWS
It is error to call mysql_thread_init() before libmysql is initialized with mysql_library_init(). Thus to fix this bug we need to detect if library was initialized and return error result if mysql_thread_init() is called with uninitialized library. Fixed by checking my_thread_global_init_done and returning nonzero if the library is not initialized.
Diffstat (limited to 'mysys')
-rw-r--r--mysys/my_thr_init.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c
index d213b67377b..5d1376ea3ce 100644
--- a/mysys/my_thr_init.c
+++ b/mysys/my_thr_init.c
@@ -313,6 +313,9 @@ my_bool my_thread_init(void)
struct st_my_thread_var *tmp;
my_bool error=0;
+ if (!my_thread_global_init_done)
+ return 1; /* cannot proceed with unintialized library */
+
#ifdef EXTRA_DEBUG_THREADS
fprintf(stderr,"my_thread_init(): thread_id: 0x%lx\n",
(ulong) pthread_self());