fix for memory leak in _ma_scan_init_block_record() (Valgrind error):
make Maria support multiple calls to rnd_init() without an rnd_end() call in between. storage/maria/ma_blockrec.c: as explained in sql/handler.h, multiple calls to rnd_init() without a rnd_end() in between, are possible, and engine must be prepared to that. So in _ma_scan_init_block_record(), we allocate a buffer only if we have not yet one.
This commit is contained in:
parent
bb4a7ad5a0
commit
f5f2a8a112
@ -3315,12 +3315,16 @@ my_bool _ma_cmp_block_unique(MARIA_HA *info, MARIA_UNIQUEDEF *def,
|
||||
|
||||
my_bool _ma_scan_init_block_record(MARIA_HA *info)
|
||||
{
|
||||
byte *ptr;
|
||||
DBUG_ENTER("_ma_scan_init_block_record");
|
||||
if (!(ptr= (byte *) my_malloc(info->s->block_size * 2, MYF(MY_WME))))
|
||||
/*
|
||||
bitmap_buff may already be allocated if this is the second call to
|
||||
rnd_init() without a rnd_end() in between, see sql/handler.h
|
||||
*/
|
||||
if (!(info->scan.bitmap_buff ||
|
||||
((info->scan.bitmap_buff=
|
||||
(byte *) my_malloc(info->s->block_size * 2, MYF(MY_WME))))))
|
||||
DBUG_RETURN(1);
|
||||
info->scan.bitmap_buff= ptr;
|
||||
info->scan.page_buff= ptr + info->s->block_size;
|
||||
info->scan.page_buff= info->scan.bitmap_buff + info->s->block_size;
|
||||
info->scan.bitmap_end= info->scan.bitmap_buff + info->s->bitmap.total_size;
|
||||
|
||||
/* Set scan variables to get _ma_scan_block() to start with reading bitmap */
|
||||
|
Loading…
x
Reference in New Issue
Block a user