From ed0bc17bee591599c988df21b8d5a264f08eb885 Mon Sep 17 00:00:00 2001 From: Monty Date: Tue, 20 Dec 2016 13:03:45 +0200 Subject: Removed usage of my_hash_search() with uninitialized HASH. - Not documented on intened usage - Extra checking takes time for all HASH usage --- sql/sql_handler.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'sql/sql_handler.cc') diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index 58db104ec96..4a27244f5b9 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -458,9 +458,10 @@ bool mysql_ha_close(THD *thd, TABLE_LIST *tables) my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0)); DBUG_RETURN(TRUE); } - if ((handler= (SQL_HANDLER*) my_hash_search(&thd->handler_tables_hash, - (uchar*) tables->alias, - strlen(tables->alias) + 1))) + if ((my_hash_inited(&thd->handler_tables_hash)) && + (handler= (SQL_HANDLER*) my_hash_search(&thd->handler_tables_hash, + (uchar*) tables->alias, + strlen(tables->alias) + 1))) { mysql_ha_close_table(handler); my_hash_delete(&thd->handler_tables_hash, (uchar*) handler); @@ -497,8 +498,10 @@ bool mysql_ha_close(THD *thd, TABLE_LIST *tables) SQL_HANDLER *mysql_ha_find_handler(THD *thd, const char *name) { SQL_HANDLER *handler; - if ((handler= (SQL_HANDLER*) my_hash_search(&thd->handler_tables_hash, - (uchar*) name, strlen(name) + 1))) + if ((my_hash_inited(&thd->handler_tables_hash)) && + (handler= (SQL_HANDLER*) my_hash_search(&thd->handler_tables_hash, + (uchar*) name, + strlen(name) + 1))) { DBUG_PRINT("info-in-hash",("'%s'.'%s' as '%s' table: %p", handler->db.str, -- cgit v1.2.1