diff options
Diffstat (limited to 'sql/handler.cc')
-rw-r--r-- | sql/handler.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index 437b11be5bb..17388267fb9 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -317,8 +317,11 @@ int handler::ha_open(const char *name, int mode, int test_if_locked) } if (!error) { - if (!(ref=(byte*) alloc_root(&table->mem_root, - ALIGN_SIZE(ref_length)*2))) + if (!alloc_root_inited(&table->mem_root)) // If temporary table + ref=sql_alloc(ALIGN_SIZE(ref_length)*2); + else + ref=(byte*) alloc_root(&table->mem_root, ALIGN_SIZE(ref_length)*2); + if (!ref) { close(); error=HA_ERR_OUT_OF_MEM; |