diff options
author | unknown <mkindahl@dl145h.mysql.com> | 2008-03-14 18:32:01 +0100 |
---|---|---|
committer | unknown <mkindahl@dl145h.mysql.com> | 2008-03-14 18:32:01 +0100 |
commit | 774d21cf3bcdf40ed3c2c33662766922cbbbb569 (patch) | |
tree | 0e9bbc644772de90097a81a9fcdbadb0b9513257 /sql/handler.cc | |
parent | 0b7d39fd5fa32c0dd3bbbdf27a2bc2cbe1bcd096 (diff) | |
parent | 269ebe54211cf96c4e64fa7268a1414588ca1de8 (diff) | |
download | mariadb-git-774d21cf3bcdf40ed3c2c33662766922cbbbb569.tar.gz |
Merge dl145h.mysql.com:/data0/mkindahl/mysql-5.1
into dl145h.mysql.com:/data0/mkindahl/mysql-5.1-rpl
mysql-test/include/commit.inc:
Auto merged
mysql-test/lib/mtr_report.pl:
Auto merged
mysql-test/r/commit_1innodb.result:
Auto merged
mysql-test/r/variables.result:
Auto merged
mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result:
Auto merged
mysql-test/t/variables.test:
Auto merged
sql/handler.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/log.cc:
Auto merged
sql/rpl_rli.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
Diffstat (limited to 'sql/handler.cc')
-rw-r--r-- | sql/handler.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index 4e6b09c069e..140d13bcb1e 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1924,6 +1924,13 @@ 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()); + /* + 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 + when the clone handler object is destroyed. + */ + 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, @@ -1992,7 +1999,9 @@ int handler::ha_open(TABLE *table_arg, const char *name, int mode, table->db_stat|=HA_READ_ONLY; (void) extra(HA_EXTRA_NO_READCHECK); // Not needed in SQL - if (!(ref= (uchar*) alloc_root(&table->mem_root, ALIGN_SIZE(ref_length)*2))) + /* ref is already allocated for us if we're called from handler::clone() */ + if (!ref && !(ref= (uchar*) alloc_root(&table->mem_root, + ALIGN_SIZE(ref_length)*2))) { close(); error=HA_ERR_OUT_OF_MEM; |