diff options
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sql/item.cc b/sql/item.cc index be7780cb015..685fdc2b69f 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -10430,7 +10430,8 @@ int Item_cache_str::save_in_field(Field *field, bool no_conversions) bool Item_cache_row::allocate(THD *thd, uint num) { item_count= num; - return (!(values= + return (!values && + !(values= (Item_cache **) thd->calloc(sizeof(Item_cache *)*item_count))); } @@ -10467,10 +10468,11 @@ bool Item_cache_row::setup(THD *thd, Item *item) for (uint i= 0; i < item_count; i++) { Item *el= item->element_index(i); - Item_cache *tmp; - if (!(tmp= values[i]= el->get_cache(thd))) + + if ((!values[i]) && !(values[i]= el->get_cache(thd))) return 1; - tmp->setup(thd, el); + + values[i]->setup(thd, el); } return 0; } |