Skip to content
Permalink
Browse files
MDEV-13818 CREATE INDEX leaks memory if running out of undo log space
free already allocated indexes if row_merge_create_index() fails

This fixes innodb.alter_crash failure
in ASAN_OPTIONS="abort_on_error=1" runs
  • Loading branch information
vuvova committed Mar 6, 2019
1 parent 2b4027e commit 65070be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
@@ -4860,7 +4860,7 @@ prepare_inplace_alter_table_dict(

/* Create the indexes in SYS_INDEXES and load into dictionary. */

for (ulint a = 0; a < ctx->num_to_add_index; a++) {
for (int a = 0; a < ctx->num_to_add_index; a++) {

if (index_defs[a].ind_type & DICT_VIRTUAL
&& ctx->num_to_drop_vcol > 0 && !new_clustered) {
@@ -4877,6 +4877,9 @@ prepare_inplace_alter_table_dict(
if (!ctx->add_index[a]) {
error = ctx->trx->error_state;
DBUG_ASSERT(error != DB_SUCCESS);
while (--a >= 0) {
dict_mem_index_free(ctx->add_index[a]);
}
goto error_handling;
}

@@ -4418,6 +4418,7 @@ row_merge_create_index(
this index, to ensure read consistency. */
ut_ad(index->trx_id == trx->id);
} else {
dict_mem_index_free(index);
index = NULL;
}

0 comments on commit 65070be

Please sign in to comment.