Commit f79f537f authored by Aleksey Midenkov's avatar Aleksey Midenkov

MDEV-21690 LeakSanitizer: detected memory leaks in mem_heap_create_block_func

parent 77c63823
...@@ -565,4 +565,11 @@ t2 CREATE TABLE `t2` ( ...@@ -565,4 +565,11 @@ t2 CREATE TABLE `t2` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop tables t2, t1; drop tables t2, t1;
set default_storage_engine= default; set default_storage_engine= default;
#
# MDEV-21690 LeakSanitizer: detected memory leaks in mem_heap_create_block_func
#
CREATE TABLE t1 (a TEXT, b TEXT) ENGINE=InnoDB;
ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (b);
ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
DROP TABLE t1;
# End of 10.5 tests # End of 10.5 tests
...@@ -519,6 +519,16 @@ drop tables t2, t1; ...@@ -519,6 +519,16 @@ drop tables t2, t1;
set default_storage_engine= default; set default_storage_engine= default;
--echo #
--echo # MDEV-21690 LeakSanitizer: detected memory leaks in mem_heap_create_block_func
--echo #
CREATE TABLE t1 (a TEXT, b TEXT) ENGINE=InnoDB;
--error ER_CANT_CREATE_TABLE
ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (b);
# Cleanup
DROP TABLE t1;
--echo # End of 10.5 tests --echo # End of 10.5 tests
--source include/wait_until_count_sessions.inc --source include/wait_until_count_sessions.inc
...@@ -12339,7 +12339,7 @@ create_table_info_t::create_foreign_keys() ...@@ -12339,7 +12339,7 @@ create_table_info_t::create_foreign_keys()
" failed. Column %s was not found.", " failed. Column %s was not found.",
operation, create_name, k.str(), operation, create_name, k.str(),
column_names[i]); column_names[i]);
dict_foreign_free(foreign);
return (DB_CANNOT_ADD_CONSTRAINT); return (DB_CANNOT_ADD_CONSTRAINT);
} }
++i; ++i;
...@@ -12353,6 +12353,7 @@ create_table_info_t::create_foreign_keys() ...@@ -12353,6 +12353,7 @@ create_table_info_t::create_foreign_keys()
"allowed).", "allowed).",
operation, create_name, k.str(), i, operation, create_name, k.str(), i,
MAX_COLS_PER_FK); MAX_COLS_PER_FK);
dict_foreign_free(foreign);
return (DB_CANNOT_ADD_CONSTRAINT); return (DB_CANNOT_ADD_CONSTRAINT);
} }
} }
...@@ -12367,6 +12368,7 @@ create_table_info_t::create_foreign_keys() ...@@ -12367,6 +12368,7 @@ create_table_info_t::create_foreign_keys()
k.str(), column_names, k.str(), column_names,
index_error, err_col, index_error, err_col,
err_index, table); err_index, table);
dict_foreign_free(foreign);
return (DB_CANNOT_ADD_CONSTRAINT); return (DB_CANNOT_ADD_CONSTRAINT);
} }
......
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