From e79847d16a0f51137ca46f23af7d5276dce7952d Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 28 Nov 2011 15:08:12 +0100 Subject: after merge fixes sql/sql_base.cc: fix a memory leak storage/xtradb/handler/ha_innodb.cc: fix for a visual studio storage/xtradb/row/row0ins.c: valgrind complains about uninitialized variable. incorrect errors in the innodb.test too --- sql/password.c | 4 ++-- sql/sql_base.cc | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'sql') diff --git a/sql/password.c b/sql/password.c index 27fbb07b6e3..64b3d69862d 100644 --- a/sql/password.c +++ b/sql/password.c @@ -196,8 +196,8 @@ check_scramble_323(const unsigned char *scrambled, const char *message, struct my_rnd_struct rand_st; ulong hash_message[2]; /* Big enough for checks. */ - char buff[16], scrambled_buff[SCRAMBLE_LENGTH_323 + 1]; - char *to, extra; + uchar buff[16], scrambled_buff[SCRAMBLE_LENGTH_323 + 1]; + uchar *to, extra; const uchar *pos; /* Ensure that the scrambled message is null-terminated. */ diff --git a/sql/sql_base.cc b/sql/sql_base.cc index c8b1067425b..ee44629a192 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2309,7 +2309,12 @@ bool reopen_name_locked_table(THD* thd, TABLE_LIST* table_list, bool link_in) if (thd->killed || !table) DBUG_RETURN(TRUE); - orig_table= *table; + /* + make a copy. we may need to restore it later. + don't use orig_table=*table, because we need an exact replica, + not a C++ copy that may modify the data in the copy constructor. + */ + memcpy(&orig_table, table, sizeof(*table)); if (open_unireg_entry(thd, table, table_list, table_name, table->s->table_cache_key.str, @@ -2322,9 +2327,10 @@ bool reopen_name_locked_table(THD* thd, TABLE_LIST* table_list, bool link_in) properly release name-lock in this case we should restore this object to its original state. */ - *table= orig_table; + memcpy(table, &orig_table, sizeof(*table)); DBUG_RETURN(TRUE); } + orig_table.alias.free(); share= table->s; /* -- cgit v1.2.1