summaryrefslogtreecommitdiff
path: root/storage/xtradb/handler/handler0alter.cc
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2020-09-28 17:04:02 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2020-09-28 17:04:02 +0530
commitfdb3c64e429cdc6f2370b7f4eefc0fbaf72eac6d (patch)
tree360cc1de3fcd4e399342bbcd54f354197d90ec1f /storage/xtradb/handler/handler0alter.cc
parent15cd9195353282e54e109962d46e1900c9eff3d4 (diff)
downloadmariadb-git-fdb3c64e429cdc6f2370b7f4eefc0fbaf72eac6d.tar.gz
MDEV-22277 LeakSanitizer: detected memory leaks in mem_heap_create_block_func after attempt to create foreign key
- During online DDL, prepare phase error handler fails to remove the memory allocated for newly created foreign keys.
Diffstat (limited to 'storage/xtradb/handler/handler0alter.cc')
-rw-r--r--storage/xtradb/handler/handler0alter.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/storage/xtradb/handler/handler0alter.cc b/storage/xtradb/handler/handler0alter.cc
index e1b2dcd2441..4126f6b60e0 100644
--- a/storage/xtradb/handler/handler0alter.cc
+++ b/storage/xtradb/handler/handler0alter.cc
@@ -3388,6 +3388,12 @@ err_exit:
trx_free_for_mysql(ctx->trx);
trx_commit_for_mysql(ctx->prebuilt->trx);
+ for (uint i = 0; i < ctx->num_to_add_fk; i++) {
+ if (ctx->add_fk[i]) {
+ dict_foreign_free(ctx->add_fk[i]);
+ }
+ }
+
delete ctx;
ha_alter_info->handler_ctx = NULL;