Commit f208f6fb authored by Monty's avatar Monty

Safety fix

Ensure that all memory allocated by TABLE_LIST::change_refs_to_fields() is
in the same memory root!
parent f9c418c6
...@@ -8822,15 +8822,16 @@ bool TABLE_LIST::change_refs_to_fields() ...@@ -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;
......
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