From 0d581562d8bce2181ec16aaa6f019ce8dc8851b4 Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Thu, 22 Oct 2020 17:09:18 +0300 Subject: [PATCH] Fix memory leak on Alter_drop allocation Fixes 7f613ebdb686 (MDEV-7284 INDEX: CREATE OR REPLACE). --- sql/sql_table.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index ec4ec0d26e9..67a505d78bc 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -6719,7 +6719,7 @@ remove_key: DBUG_ASSERT(key->or_replace()); Alter_drop::drop_type type= (key->type == Key::FOREIGN_KEY) ? Alter_drop::FOREIGN_KEY : Alter_drop::KEY; - Alter_drop *ad= new Alter_drop(type, key->name.str, FALSE); + Alter_drop *ad= new (thd->mem_root) Alter_drop(type, key->name.str, FALSE); if (ad != NULL) { // Adding the index into the drop list for replacing