Commit 5b0b6660 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-17413 - Don't crash in my_malloc_size_cb_func()

if thread specific memory is requested and current_thd is NULL.

Leave DBUG_ASSERT() in place, to check in DBUG version.
parent f517d8c7
......@@ -3907,14 +3907,16 @@ static void my_malloc_size_cb_func(long long size, my_bool is_thread_specific)
{
THD *thd= current_thd;
if (is_thread_specific) /* If thread specific memory */
{
/*
When thread specfic is set, both mysqld_server_initialized and thd
must be set
*/
DBUG_ASSERT(mysqld_server_initialized && thd);
/*
When thread specific is set, both mysqld_server_initialized and thd
must be set, and we check that with DBUG_ASSERT.
However, do not crash, if current_thd is NULL, in release version.
*/
DBUG_ASSERT(!is_thread_specific || (mysqld_server_initialized && thd));
if (is_thread_specific && likely(thd)) /* If thread specific memory */
{
DBUG_PRINT("info", ("thd memory_used: %lld size: %lld",
(longlong) thd->status_var.local_memory_used,
size));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment