mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Bug#11765252 - READ OF FREED MEMORY WHEN "USE DB" AND
"SHOW PROCESSLIST" Merging from 5.1 to 5.5
This commit is contained in:
@ -1843,10 +1843,10 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
|
||||
thd_info->host= thd->strdup(tmp_sctx->host_or_ip[0] ?
|
||||
tmp_sctx->host_or_ip :
|
||||
tmp_sctx->host ? tmp_sctx->host : "");
|
||||
if ((thd_info->db=tmp->db)) // Safe test
|
||||
thd_info->db=thd->strdup(thd_info->db);
|
||||
thd_info->command=(int) tmp->command;
|
||||
mysql_mutex_lock(&tmp->LOCK_thd_data);
|
||||
if ((thd_info->db= tmp->db)) // Safe test
|
||||
thd_info->db= thd->strdup(thd_info->db);
|
||||
if ((mysys_var= tmp->mysys_var))
|
||||
mysql_mutex_lock(&mysys_var->mutex);
|
||||
thd_info->proc_info= (char*) (tmp->killed == THD::KILL_CONNECTION? "Killed" : 0);
|
||||
@ -1920,7 +1920,7 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
|
||||
{
|
||||
Security_context *tmp_sctx= tmp->security_ctx;
|
||||
struct st_my_thread_var *mysys_var;
|
||||
const char *val;
|
||||
const char *val, *db;
|
||||
|
||||
if ((!tmp->vio_ok() && !tmp->system_thread) ||
|
||||
(user && (!tmp_sctx->user || strcmp(tmp_sctx->user, user))))
|
||||
@ -1946,13 +1946,13 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
|
||||
table->field[2]->store(tmp_sctx->host_or_ip,
|
||||
strlen(tmp_sctx->host_or_ip), cs);
|
||||
/* DB */
|
||||
if (tmp->db)
|
||||
mysql_mutex_lock(&tmp->LOCK_thd_data);
|
||||
if ((db= tmp->db))
|
||||
{
|
||||
table->field[3]->store(tmp->db, strlen(tmp->db), cs);
|
||||
table->field[3]->store(db, strlen(db), cs);
|
||||
table->field[3]->set_notnull();
|
||||
}
|
||||
|
||||
mysql_mutex_lock(&tmp->LOCK_thd_data);
|
||||
if ((mysys_var= tmp->mysys_var))
|
||||
mysql_mutex_lock(&mysys_var->mutex);
|
||||
/* COMMAND */
|
||||
|
Reference in New Issue
Block a user