diff options
Diffstat (limited to 'sql/handler.cc')
-rw-r--r-- | sql/handler.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index 10f14be26ae..7ff4a616fd7 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -2029,6 +2029,10 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path, handler *handler::clone(MEM_ROOT *mem_root) { handler *new_handler= get_new_handler(table->s, mem_root, table->s->db_type()); + + if (!new_handler) + return NULL; + /* Allocate handler->ref here because otherwise ha_open will allocate it on this->table->mem_root and we will not be able to reclaim that memory @@ -2036,12 +2040,13 @@ handler *handler::clone(MEM_ROOT *mem_root) */ if (!(new_handler->ref= (uchar*) alloc_root(mem_root, ALIGN_SIZE(ref_length)*2))) return NULL; - if (new_handler && !new_handler->ha_open(table, - table->s->normalized_path.str, - table->db_stat, - HA_OPEN_IGNORE_IF_LOCKED)) - return new_handler; - return NULL; + if (new_handler->ha_open(table, + table->s->normalized_path.str, + table->db_stat, + HA_OPEN_IGNORE_IF_LOCKED)) + return NULL; + new_handler->cloned= 1; // Marker for debugging + return new_handler; } |