Bug#17928281 'CHECK_PERFORMANCE_SCHEMA()' LEAVES 'CURRENT_THD' REFERRING DESTRUCTED THD OBJ 
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.


flynn1973/mariadb-aix,ollie314/server,slanterns/server,davidl-zend/zenddbi,natsys/mariadb_10.2,davidl-zend/zenddbi,natsys/mariadb_10.2,davidl-zend/zenddbi,davidl-zend/zenddbi,flynn1973/mariadb-aix,flynn1973/mariadb-aix,davidl-zend/zenddbi,davidl-zend/zenddbi,ollie314/server,flynn1973/mariadb-aix,flynn1973/mariadb-aix,ollie314/server,davidl-zend/zenddbi,flynn1973/mariadb-aix,flynn1973/mariadb-aix,flynn1973/mariadb-aix,natsys/mariadb_10.2,ollie314/server,flynn1973/mariadb-aix,natsys/mariadb_10.2,natsys/mariadb_10.2,davidl-zend/zenddbi,ollie314/server,ollie314/server,natsys/mariadb_10.2,ollie314/server,ollie314/server,natsys/mariadb_10.2,natsys/mariadb_10.2,ollie314/server,flynn1973/mariadb-aix,natsys/mariadb_10.2,ollie314/server,davidl-zend/zenddbi,davidl-zend/zenddbi,flynn1973/mariadb-aix,natsys/mariadb_10.2,natsys/mariadb_10.2,ollie314/server,davidl-zend/zenddbi