Commit 91a43f7e authored by osku's avatar osku

Port r225 from branches/5.0:

Fix memory allocation bug (by changing MY_WME to MY_FAE) in
ha_innodb.cc:get_share.
parent 6be49d67
...@@ -6787,23 +6787,24 @@ static INNOBASE_SHARE* get_share(const char* table_name) ...@@ -6787,23 +6787,24 @@ static INNOBASE_SHARE* get_share(const char* table_name)
if (!(share=(INNOBASE_SHARE*) hash_search(&innobase_open_tables, if (!(share=(INNOBASE_SHARE*) hash_search(&innobase_open_tables,
(mysql_byte*) table_name, (mysql_byte*) table_name,
length))) { length))) {
if ((share=(INNOBASE_SHARE *) my_malloc(sizeof(*share)+length+1,
MYF(MY_WME | MY_ZEROFILL)))) {
share->table_name_length=length;
share->table_name=(char*) (share+1);
strmov(share->table_name,table_name);
if (my_hash_insert(&innobase_open_tables,
(mysql_byte*) share)) {
pthread_mutex_unlock(&innobase_share_mutex);
my_free((gptr) share,0);
return 0;
}
thr_lock_init(&share->lock); share = (INNOBASE_SHARE *) my_malloc(sizeof(*share)+length+1,
pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST); MYF(MY_FAE | MY_ZEROFILL));
share->table_name_length=length;
share->table_name=(char*) (share+1);
strmov(share->table_name,table_name);
if (my_hash_insert(&innobase_open_tables,
(mysql_byte*) share)) {
pthread_mutex_unlock(&innobase_share_mutex);
my_free((gptr) share,0);
return 0;
} }
thr_lock_init(&share->lock);
pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST);
} }
share->use_count++; share->use_count++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment