Commit 82eed657 authored by Marc Alff's avatar Marc Alff

Bug#17928281 'CHECK_PERFORMANCE_SCHEMA()' LEAVES 'CURRENT_THD' REFERRING

DESTRUCTED THD OBJ 

Prior to fix, function check_performance_schema() could leave
behind stale pointers in thread local storage, for the following keys:
- THR_THD (used by _current_thd)
- THR_MALLOC (used for memory allocation)
This is an unsafe practice, which can potentially cause crashes,
and that can cause other bugs when code is modified during maintenance.

With this fix, thread local storage keys used temporarily within
function check_performance_schema() are cleaned up after use.
parent c90cdf5d
/* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -55,6 +55,7 @@ void check_performance_schema() ...@@ -55,6 +55,7 @@ void check_performance_schema()
PFS_engine_table_share::check_all_tables(thd); PFS_engine_table_share::check_all_tables(thd);
thd->restore_globals();
delete thd; delete thd;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
......
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