diff options
author | Monty <monty@mariadb.org> | 2016-12-20 13:03:45 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2017-01-11 09:18:35 +0200 |
commit | ed0bc17bee591599c988df21b8d5a264f08eb885 (patch) | |
tree | b0ecffbdd161e067a10096b3a55099adb2164e0f /sql/sql_handler.cc | |
parent | e80ad58de8bce0923b91c08d12959c42e9e213a5 (diff) | |
download | mariadb-git-ed0bc17bee591599c988df21b8d5a264f08eb885.tar.gz |
Removed usage of my_hash_search() with uninitialized HASH.
- Not documented on intened usage
- Extra checking takes time for all HASH usage
Diffstat (limited to 'sql/sql_handler.cc')
-rw-r--r-- | sql/sql_handler.cc | 13 |
1 files changed, 8 insertions, 5 deletions
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, |