diff options
author | unknown <davi@mysql.com/endora.local> | 2008-03-25 15:53:57 -0300 |
---|---|---|
committer | unknown <davi@mysql.com/endora.local> | 2008-03-25 15:53:57 -0300 |
commit | c3641cd5136f7bb0b79475b0bcb0b97f20150e14 (patch) | |
tree | 93885267e79e6a659af6e5ae11e25f83900e8d0e /mysys/mf_keycache.c | |
parent | 2d5a444d1fac9dc1866231355ea791ea0545fdd8 (diff) | |
download | mariadb-git-c3641cd5136f7bb0b79475b0bcb0b97f20150e14.tar.gz |
Bug#35272: @@global.key_buffer_size = 4294967295 let the server crash
When trying to get the requested amount of memory for the keybuffer,
the out of memory could be signaled if one of the tentative allocations
fail. Later the server would crash (debug assert) when trying to send
a ok packet with a error set.
The solution is only to signal the error if all tentative allocations
for the keybuffer fail.
mysql-test/r/key_cache.result:
Add test case result for Bug#35272
mysql-test/t/key_cache.test:
Add test case for Bug#35272
mysys/mf_keycache.c:
Don't set error on my_large_malloc if allocation fails.
Set the error if all tentative allocations failed.
Diffstat (limited to 'mysys/mf_keycache.c')
-rw-r--r-- | mysys/mf_keycache.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index a03d71f32d8..8001c61a6b9 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -102,6 +102,7 @@ */ #include "mysys_priv.h" +#include "mysys_err.h" #include <keycache.h> #include "my_static.h" #include <m_string.h> @@ -430,7 +431,7 @@ int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size, /* Allocate memory for cache page buffers */ if ((keycache->block_mem= my_large_malloc((size_t) blocks * keycache->key_cache_block_size, - MYF(MY_WME)))) + MYF(0)))) { /* Allocate memory for blocks, hash_links and hash entries; @@ -445,6 +446,7 @@ int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size, if (blocks < 8) { my_errno= ENOMEM; + my_error(EE_OUTOFMEMORY, MYF(0), blocks * keycache->key_cache_block_size); goto err; } blocks= blocks / 4*3; |