summaryrefslogtreecommitdiff
path: root/sql/sp.cc
diff options
context:
space:
mode:
authorKristofer Pettersson <kristofer.pettersson@sun.com>2009-11-20 16:18:01 +0100
committerKristofer Pettersson <kristofer.pettersson@sun.com>2009-11-20 16:18:01 +0100
commit0a686030589dae2fe6bf99f4c3d4a73d4268a491 (patch)
tree2c684f720a7791634409c9607d9ffcd82d0d1b73 /sql/sp.cc
parente942adb23dfca74fa8db76dbe40d72f0ceff4818 (diff)
downloadmariadb-git-0a686030589dae2fe6bf99f4c3d4a73d4268a491.tar.gz
Bug#45613 handle failures from my_hash_insert
Not all my_hash_insert() calls are checked for return value. This patch adds appropriate checks and failure responses where needed. mysys/hash.c: * Debug hook for testing failures in my_hash_insert()
Diffstat (limited to 'sql/sp.cc')
-rw-r--r--sql/sp.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/sql/sp.cc b/sql/sp.cc
index fd420732628..b254ba8e694 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -1506,7 +1506,8 @@ static bool add_used_routine(LEX *lex, Query_arena *arena,
rn->key.length= key->length;
rn->key.str= (char *)rn + sizeof(Sroutine_hash_entry);
memcpy(rn->key.str, key->str, key->length + 1);
- my_hash_insert(&lex->sroutines, (uchar *)rn);
+ if (my_hash_insert(&lex->sroutines, (uchar *)rn))
+ return FALSE;
lex->sroutines_list.link_in_list((uchar *)rn, (uchar **)&rn->next);
rn->belong_to_view= belong_to_view;
return TRUE;
@@ -1584,16 +1585,24 @@ void sp_remove_not_own_routines(LEX *lex)
dependant on time of life of elements from source hash. It also
won't touch lists linking elements in source and destination
hashes.
+
+ @returns
+ @return TRUE Failure
+ @return FALSE Success
*/
-void sp_update_sp_used_routines(HASH *dst, HASH *src)
+bool sp_update_sp_used_routines(HASH *dst, HASH *src)
{
for (uint i=0 ; i < src->records ; i++)
{
Sroutine_hash_entry *rt= (Sroutine_hash_entry *)hash_element(src, i);
if (!hash_search(dst, (uchar *)rt->key.str, rt->key.length))
- my_hash_insert(dst, (uchar *)rt);
+ {
+ if (my_hash_insert(dst, (uchar *)rt))
+ return TRUE;
+ }
}
+ return FALSE;
}