diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2018-06-23 09:47:18 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2018-06-25 13:28:09 +0200 |
commit | 46fc864b90228e007e13fbd166674309d51bf955 (patch) | |
tree | c36654819914b9662db193a642feea71cc6a396e /libmysqld/lib_sql.cc | |
parent | 88aaf590ac9fa8c8030a5831cebd867a7f35478f (diff) | |
download | mariadb-git-46fc864b90228e007e13fbd166674309d51bf955.tar.gz |
MDEV-16478: mysql_real_connect() from libmariadbd.so always crash
Returned accidentally removed undefinition of MYSQL_SERVER in net_serv.cc inside embedded server
(embedded server uses real_net_read/write only as a client)
Prevented attempt to clean up embedded server if it was not initialized
Diffstat (limited to 'libmysqld/lib_sql.cc')
-rw-r--r-- | libmysqld/lib_sql.cc | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index d32a96255b9..dd111d1b224 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -55,6 +55,9 @@ extern "C" void unireg_clear(int exit_code) DBUG_VOID_RETURN; } + +static my_bool mysql_embedded_init= 0; + /* Wrapper error handler for embedded server to call client/server error handler based on whether thread is in client/server context @@ -518,6 +521,8 @@ int init_embedded_server(int argc, char **argv, char **groups) const char *fake_groups[] = { "server", "embedded", 0 }; my_bool acl_error; + DBUG_ASSERT(mysql_embedded_init == 0); + if (my_thread_init()) return 1; @@ -637,15 +642,19 @@ int init_embedded_server(int argc, char **argv, char **groups) } execute_ddl_log_recovery(); + mysql_embedded_init= 1; return 0; } void end_embedded_server() { - my_free(copy_arguments_ptr); - copy_arguments_ptr=0; - clean_up(0); - clean_up_mutexes(); + if (mysql_embedded_init) + { + my_free(copy_arguments_ptr); + copy_arguments_ptr=0; + clean_up(0); + clean_up_mutexes(); + } } |