mirror of
https://github.com/MariaDB/server.git
synced 2025-04-18 21:44:20 +03:00
Fixed mysqld_list_processes to remove a possibility to access null pointers
This commit is contained in:
parent
809a0cebdc
commit
aea440d3e7
@ -2943,25 +2943,27 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
|
||||
|
||||
while (thread_info *thd_info= arg.thread_infos.get())
|
||||
{
|
||||
const char *str;
|
||||
ulonglong start_time;
|
||||
CSET_STRING query;
|
||||
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(thd_info->thread_id);
|
||||
protocol->store(thd_info->user, strlen(thd_info->user), system_charset_info);
|
||||
protocol->store(thd_info->host, strlen(thd_info->host), system_charset_info);
|
||||
protocol->store_string_or_null(thd_info->db, system_charset_info);
|
||||
if (thd_info->proc_info)
|
||||
protocol->store(thd_info->proc_info, strlen(thd_info->proc_info),
|
||||
system_charset_info);
|
||||
if ((str= thd_info->proc_info))
|
||||
protocol->store(str, strlen(str), system_charset_info);
|
||||
else
|
||||
protocol->store(&command_name[thd_info->command], system_charset_info);
|
||||
if (thd_info->start_time && now > thd_info->start_time)
|
||||
protocol->store_long((now - thd_info->start_time) / HRTIME_RESOLUTION);
|
||||
if ((start_time= thd_info->start_time) && now > start_time)
|
||||
protocol->store_long((now - start_time) / HRTIME_RESOLUTION);
|
||||
else
|
||||
protocol->store_null();
|
||||
protocol->store_string_or_null(thd_info->state_info, system_charset_info);
|
||||
if (thd_info->query_string.length())
|
||||
protocol->store(thd_info->query_string.str(),
|
||||
thd_info->query_string.length(),
|
||||
thd_info->query_string.charset());
|
||||
query= thd_info->query_string;
|
||||
if (query.length() && query.str())
|
||||
protocol->store(query.str(), query.length(), query.charset());
|
||||
else
|
||||
protocol->store_null();
|
||||
if (!(thd->variables.old_behavior & OLD_MODE_NO_PROGRESS_INFO))
|
||||
|
Loading…
x
Reference in New Issue
Block a user