1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Removed usage of my_hash_search() with uninitialized HASH.

- Not documented on intened usage
- Extra checking takes time for all HASH usage
This commit is contained in:
Monty
2016-12-20 13:03:45 +02:00
parent e80ad58de8
commit ed0bc17bee
4 changed files with 19 additions and 13 deletions

View File

@ -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,