mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
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.
This commit is contained in:
parent
f517d8c742
commit
5b0b6660f6
1 changed files with 9 additions and 7 deletions
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue