Partial fix for Bug#11764622 57480: MEMORY LEAK WHEN HAVING 256+ TABLES
Partial fix for Bug#11764622 57480: MEMORY LEAK WHEN HAVING 256+ TABLES

Port vasil.dimov@oracle.com-20111205082626-87j5f48dq1ouk86r from mysql-trunk

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