mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user