1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

Safety fix

Ensure that all memory allocated by TABLE_LIST::change_refs_to_fields() is
in the same memory root!
This commit is contained in:
Monty
2022-11-28 18:07:43 +02:00
parent f9c418c67d
commit f208f6fb6f

View File

@@ -8822,15 +8822,16 @@ bool TABLE_LIST::change_refs_to_fields()
List_iterator<Item> li(used_items); List_iterator<Item> li(used_items);
Item_direct_ref *ref; Item_direct_ref *ref;
Field_iterator_view field_it; Field_iterator_view field_it;
Name_resolution_context *ctx;
THD *thd= table->in_use; THD *thd= table->in_use;
Item **materialized_items;
DBUG_ASSERT(is_merged_derived()); DBUG_ASSERT(is_merged_derived());
if (!used_items.elements) if (!used_items.elements)
return FALSE; return FALSE;
Item **materialized_items= materialized_items= (Item **)thd->calloc(sizeof(void *) * table->s->fields);
(Item **)thd->calloc(sizeof(void *) * table->s->fields); ctx= new (thd->mem_root) Name_resolution_context(this);
Name_resolution_context *ctx= new Name_resolution_context(this);
if (!materialized_items || !ctx) if (!materialized_items || !ctx)
return TRUE; return TRUE;