mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Only set thd->query to 0 if LOCK_thread_count is hold
This fixes a possible core dump problem in SHOW PROCESSLIST
This commit is contained in:
@@ -89,9 +89,9 @@ void mysql_create_db(THD *thd, char *db, uint create_options)
|
||||
}
|
||||
if (!thd->query)
|
||||
{
|
||||
thd->query = path;
|
||||
thd->query_length = (uint) (strxmov(path,"create database ", db, NullS)-
|
||||
path);
|
||||
thd->query = path;
|
||||
}
|
||||
{
|
||||
mysql_update_log.write(thd,thd->query, thd->query_length);
|
||||
@@ -103,8 +103,9 @@ void mysql_create_db(THD *thd, char *db, uint create_options)
|
||||
}
|
||||
if (thd->query == path)
|
||||
{
|
||||
VOID(pthread_mutex_lock(&LOCK_thread_count));
|
||||
thd->query = 0; // just in case
|
||||
thd->query_length = 0;
|
||||
VOID(pthread_mutex_unlock(&LOCK_thread_count));
|
||||
}
|
||||
send_ok(&thd->net, result);
|
||||
|
||||
@@ -178,9 +179,9 @@ void mysql_rm_db(THD *thd,char *db,bool if_exists)
|
||||
|
||||
if (!thd->query)
|
||||
{
|
||||
thd->query = path;
|
||||
thd->query_length = (uint) (strxmov(path,"drop database ", db, NullS)-
|
||||
path);
|
||||
thd->query = path;
|
||||
}
|
||||
mysql_update_log.write(thd, thd->query, thd->query_length);
|
||||
if (mysql_bin_log.is_open())
|
||||
@@ -190,8 +191,9 @@ void mysql_rm_db(THD *thd,char *db,bool if_exists)
|
||||
}
|
||||
if (thd->query == path)
|
||||
{
|
||||
VOID(pthread_mutex_lock(&LOCK_thread_count));
|
||||
thd->query = 0; // just in case
|
||||
thd->query_length = 0;
|
||||
VOID(pthread_mutex_unlock(&LOCK_thread_count));
|
||||
}
|
||||
send_ok(&thd->net,(ulong) deleted);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user