diff options
author | Jan Lindström <jan.lindstrom@mariadb.com> | 2019-08-20 10:32:04 +0300 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@mariadb.com> | 2019-08-20 10:32:04 +0300 |
commit | 7b4de10477a7bdb51656d827ad2d914d29a4be4c (patch) | |
tree | bf1bade9ffc78d908539de4832c2800369375f85 /sql/wsrep_mysqld.cc | |
parent | c5bc0cedea01cabfcd3a8d0d1410e427e2edc08e (diff) | |
download | mariadb-git-7b4de10477a7bdb51656d827ad2d914d29a4be4c.tar.gz |
MDEV-20378: Galera uses uninitialized memory
Problem was that wsrep thread argument was deleted on wrong
place. Furthermore, scan method incorrectly used unsafe c_ptr().
Finally, fixed wsrep thread initialization to correctly set
up thread_id and pass correct argument to functions and
fix signess problem causing compiler errors.
Diffstat (limited to 'sql/wsrep_mysqld.cc')
-rw-r--r-- | sql/wsrep_mysqld.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 74a28c4724f..0a9adc5fa2c 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -2696,7 +2696,7 @@ void* start_wsrep_THD(void *arg) WSREP_DEBUG("wsrep system thread %llu, %p starting", thd->thread_id, thd); - thd_args->fun()(thd, thd_args->args()); + thd_args->fun()(thd, static_cast<void *>(thd_args)); WSREP_DEBUG("wsrep system thread: %llu, %p closing", thd->thread_id, thd); @@ -2707,8 +2707,6 @@ void* start_wsrep_THD(void *arg) close_connection(thd, 0); - delete thd_args; - mysql_mutex_lock(&LOCK_wsrep_slave_threads); DBUG_ASSERT(wsrep_running_threads > 0); wsrep_running_threads--; @@ -2727,6 +2725,7 @@ void* start_wsrep_THD(void *arg) break; } + delete thd_args; WSREP_DEBUG("wsrep running threads now: %lu", wsrep_running_threads); mysql_cond_broadcast(&COND_wsrep_slave_threads); mysql_mutex_unlock(&LOCK_wsrep_slave_threads); |