diff options
author | Monty <monty@mariadb.org> | 2022-11-28 18:07:43 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2022-11-29 03:34:35 +0200 |
commit | f208f6fb6fff31b9216f059ead435397ca74b56c (patch) | |
tree | 8d7dd409aec1eb144bb837b16f750c197ab12210 | |
parent | f9c418c67d9a1339364358fe5974547e3f9c511c (diff) | |
download | mariadb-git-f208f6fb6fff31b9216f059ead435397ca74b56c.tar.gz |
Safety fix
Ensure that all memory allocated by TABLE_LIST::change_refs_to_fields() is
in the same memory root!
-rw-r--r-- | sql/table.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sql/table.cc b/sql/table.cc index 9dc7cabffc6..54a1e8b1b57 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -8822,15 +8822,16 @@ bool TABLE_LIST::change_refs_to_fields() List_iterator<Item> li(used_items); Item_direct_ref *ref; Field_iterator_view field_it; + Name_resolution_context *ctx; THD *thd= table->in_use; + Item **materialized_items; DBUG_ASSERT(is_merged_derived()); if (!used_items.elements) return FALSE; - Item **materialized_items= - (Item **)thd->calloc(sizeof(void *) * table->s->fields); - Name_resolution_context *ctx= new Name_resolution_context(this); + materialized_items= (Item **)thd->calloc(sizeof(void *) * table->s->fields); + ctx= new (thd->mem_root) Name_resolution_context(this); if (!materialized_items || !ctx) return TRUE; |