diff options
author | unknown <kaa@kaamos.(none)> | 2008-02-17 14:57:01 +0300 |
---|---|---|
committer | unknown <kaa@kaamos.(none)> | 2008-02-17 14:57:01 +0300 |
commit | 695865fee9566bc026858214e8717a8155505a5a (patch) | |
tree | 32ec9a2109f5937fa7bbd8c249cb71d6546ed347 /sql/handler.cc | |
parent | 410e2d64d14fc2ea5193fc0111142aca182ed348 (diff) | |
parent | d740f5c67567479149d2aea524b2463748f3b7ac (diff) | |
download | mariadb-git-695865fee9566bc026858214e8717a8155505a5a.tar.gz |
Merge kaamos.(none):/data/src/mysql-5.1
into kaamos.(none):/data/src/opt/mysql-5.1-opt
libmysqld/lib_sql.cc:
Auto merged
mysql-test/r/create.result:
Auto merged
mysql-test/r/innodb_mysql.result:
Auto merged
mysql-test/r/variables.result:
Auto merged
BitKeeper/deleted/.del-rpl_ndb_charset.result:
Auto merged
BitKeeper/deleted/.del-rpl_row_charset.result:
Auto merged
BitKeeper/deleted/.del-rpl_row_charset.test:
Auto merged
BitKeeper/deleted/.del-rpl_row_charset_innodb.result:
Auto merged
mysql-test/t/create.test:
Auto merged
mysql-test/t/sp.test:
Auto merged
mysql-test/t/variables.test:
Auto merged
sql/field.cc:
Auto merged
sql/filesort.cc:
Auto merged
sql/handler.cc:
Auto merged
sql/item.cc:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/share/errmsg.txt:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
mysql-test/lib/mtr_report.pl:
Manual merge.
mysql-test/r/sp.result:
Manual merge.
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 95d63740039..a71a60ee06f 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1522,6 +1522,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, @@ -1590,7 +1597,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; |