Skip to content

Commit

Permalink
MDEV-13818 CREATE INDEX leaks memory if running out of undo log space
Browse files Browse the repository at this point in the history
if create_index_dict() fails, we need to free ctx->add_index[a] too

This fixes innodb.alter_crash and innodb.instant_alter_debug
failures in ASAN_OPTIONS="abort_on_error=1" runs
  • Loading branch information
vuvova committed Mar 7, 2019
1 parent 2bd204b commit d30f17a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions storage/innobase/handler/handler0alter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5634,18 +5634,19 @@ prepare_inplace_alter_table_dict(
ctx->trx->table_id = user_table->id;

for (ulint a = 0; a < ctx->num_to_add_index; a++) {
dict_index_t*& index = ctx->add_index[a];
dict_index_t* index = ctx->add_index[a];
const bool has_new_v_col = index->has_new_v_col;
index = create_index_dict(ctx->trx, index, add_v);
if (!index) {
error = ctx->trx->error_state;
ut_ad(error != DB_SUCCESS);
error_handling_drop_uncached:
while (++a < ctx->num_to_add_index) {
do {
dict_mem_index_free(ctx->add_index[a]);
}
} while (++a < ctx->num_to_add_index);
goto error_handling;
}
ctx->add_index[a]= index;

index->parser = index_defs[a].parser;
index->has_new_v_col = has_new_v_col;
Expand Down

0 comments on commit d30f17a

Please sign in to comment.