mirror of
https://github.com/MariaDB/server.git
synced 2025-01-20 14:02:32 +01:00
branches/zip: Remove reads of freed memory in fast index creation.
Because row_drop_table_for_mysql_no_commit() checks with dict_load_table() if the table was successfully dropped, we cannot pass table->name to it. row_merge_drop_table(): Pass a copy of table->name to row_drop_table_for_mysql(). row_prebuilt_free(): Do not dereference prebuilt->table->name after a successful invocation of row_add_table_to_background_drop_list(). The table object may be freed at any time. Remove the debug message "Dropping table".
This commit is contained in:
parent
62ad3dbd71
commit
a5ddf51aa2
2 changed files with 9 additions and 14 deletions
|
@ -1620,8 +1620,14 @@ row_merge_drop_table(
|
|||
|
||||
/* Drop the table immediately iff it is not references by MySQL */
|
||||
if (table->n_mysql_handles_opened == 0) {
|
||||
/* Copy table->name, because table will have been
|
||||
freed when row_drop_table_for_mysql_no_commit()
|
||||
checks with dict_load_table() that the table was
|
||||
indeed dropped. */
|
||||
char* table_name = mem_strdup(table->name);
|
||||
/* Set the commit flag to FALSE. */
|
||||
err = row_drop_table_for_mysql(table->name, trx, FALSE);
|
||||
err = row_drop_table_for_mysql(table_name, trx, FALSE);
|
||||
mem_free(table_name);
|
||||
}
|
||||
|
||||
if (dict_locked) {
|
||||
|
|
|
@ -749,26 +749,15 @@ row_prebuilt_free(
|
|||
references to it now.*/
|
||||
if (prebuilt->table->to_be_dropped
|
||||
&& prebuilt->table->n_mysql_handles_opened == 0) {
|
||||
ibool added;
|
||||
ut_a(*prebuilt->table->name == TEMP_TABLE_PREFIX);
|
||||
|
||||
added = row_add_table_to_background_drop_list(prebuilt->table);
|
||||
|
||||
ut_print_timestamp(stderr);
|
||||
|
||||
if (added) {
|
||||
fputs(" InnoDB: Dropping table ", stderr);
|
||||
ut_print_name(stderr, NULL, TRUE,
|
||||
prebuilt->table->name);
|
||||
putc('\n', stderr);
|
||||
} else {
|
||||
if (!row_add_table_to_background_drop_list(prebuilt->table)) {
|
||||
fputs(" InnoDB: Error: failed trying to add ",
|
||||
stderr);
|
||||
ut_print_name(stderr, NULL, TRUE,
|
||||
prebuilt->table->name);
|
||||
fputs(" to the background drop list.\n", stderr);
|
||||
}
|
||||
|
||||
ut_a(*prebuilt->table->name == TEMP_TABLE_PREFIX);
|
||||
}
|
||||
|
||||
UT_LIST_REMOVE(prebuilts, prebuilt->table->prebuilts, prebuilt);
|
||||
|
|
Loading…
Reference in a new issue