Commit a6d32976 authored by Monty's avatar Monty

Fixed memory leak with fulltext indexes

MDEV-22275 Assertion `global_status_var.global_memory_used == 0'
failed, bytes lost, or LeakSanitizer: detected memory leaks
after using temporary table with fulltext key

This affected MyISAM and Aria temporary tables
parent 70bb6141
......@@ -776,3 +776,14 @@ CREATE FULLTEXT INDEX IF NOT EXISTS ft1 ON t1(title);
Warnings:
Note 1061 Duplicate key name 'ft1'
DROP TABLE t1;
#
# MDEV-22275 (Memory leak)
#
CREATE TEMPORARY TABLE tmp (a TEXT) ENGINE=MyISAM;
ALTER TABLE tmp ADD FULLTEXT (a);
INSERT INTO tmp VALUES ('foo');
DROP TABLE tmp;
CREATE TEMPORARY TABLE tmp (a TEXT) ENGINE=Aria;
ALTER TABLE tmp ADD FULLTEXT (a);
INSERT INTO tmp VALUES ('foo');
DROP TABLE tmp;
......@@ -716,3 +716,17 @@ CREATE TABLE t1 (
CREATE FULLTEXT INDEX IF NOT EXISTS ft1 ON t1(title);
CREATE FULLTEXT INDEX IF NOT EXISTS ft1 ON t1(title);
DROP TABLE t1;
--echo #
--echo # MDEV-22275 (Memory leak)
--echo #
CREATE TEMPORARY TABLE tmp (a TEXT) ENGINE=MyISAM;
ALTER TABLE tmp ADD FULLTEXT (a);
INSERT INTO tmp VALUES ('foo');
DROP TABLE tmp;
CREATE TEMPORARY TABLE tmp (a TEXT) ENGINE=Aria;
ALTER TABLE tmp ADD FULLTEXT (a);
INSERT INTO tmp VALUES ('foo');
DROP TABLE tmp;
......@@ -20,7 +20,7 @@
to open other files during the time we flush the cache and close this file
*/
#include "maria_def.h"
#include "ma_ftdefs.h"
#include "ma_crypt.h"
int maria_close(register MARIA_HA *info)
......@@ -86,6 +86,7 @@ int maria_close(register MARIA_HA *info)
share->open_list= list_delete(share->open_list, &info->share_list);
}
maria_ftparser_call_deinitializer(info);
my_free(info->rec_buff);
(*share->end)(info);
......
......@@ -20,7 +20,7 @@
to open other files during the time we flush the cache and close this file
*/
#include "myisamdef.h"
#include "ftdefs.h"
int mi_close(register MI_INFO *info)
{
......@@ -60,6 +60,8 @@ int mi_close(register MI_INFO *info)
mysql_mutex_unlock(&share->intern_lock);
my_free(mi_get_rec_buff_ptr(info, info->rec_buff));
ftparser_call_deinitializer(info);
if (flag)
{
DBUG_EXECUTE_IF("crash_before_flush_keys",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment