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.
This commit is contained in:
Marc Alff 2013-12-11 11:15:23 +01:00
parent 9418fea133
commit b734cd73ff

View File

@ -1,4 +1,4 @@
/* 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
it under the terms of the GNU General Public License as published by
@ -55,6 +55,7 @@ void check_performance_schema()
PFS_engine_table_share::check_all_tables(thd);
thd->restore_globals();
delete thd;
DBUG_VOID_RETURN;
}