mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
MDEV-28268: Server crashes in Expression_cache_tracker::fetch_current_stats
Expression_cache_tmptable object uses an Expression_cache_tracker object to report the statistics. In the common scenario, Expression_cache_tmptable destructor sets tracker->cache=NULL. The tracker object survives after the expression cache is deleted and one may call cache_tracker->fetch_current_stats() for it with no harm. However a degenerate cache with no parameters does not set tracker->cache=NULL in Expression_cache_tmptable destructor which results in an attempt to use freed data in the cache_tracker->fetch_current_stats() call. Fixed by setting tracker->cache to NULL and wrapping the assignment into a function.
This commit is contained in:
@ -63,7 +63,7 @@ void Expression_cache_tmptable::disable_cache()
|
||||
cache_table= NULL;
|
||||
update_tracker();
|
||||
if (tracker)
|
||||
tracker->cache= NULL;
|
||||
tracker->detach_from_cache();
|
||||
}
|
||||
|
||||
|
||||
@ -188,6 +188,8 @@ Expression_cache_tmptable::~Expression_cache_tmptable()
|
||||
else
|
||||
{
|
||||
update_tracker();
|
||||
if (tracker)
|
||||
tracker->detach_from_cache();
|
||||
tracker= NULL;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user