Description:
Items created when parsing the partitioning expression in ALTER TABLE ... PARTITION are freed in closefrm(). However, if an error occurs before the actual creation of the .frm, closefrm() is obviously not called causing memory allocated by item tree corresponding to the partitioning expression to leak.
How to repeat:
mysql> CREATE TABLE t1 (a TIMESTAMP);
gdb> br mysql_unpack_partition
gdb> c
mysql> ALTER TABLE t1 PARTITION BY RANGE("1") (PARTITION p VALUES LESS THAN (1), PARTITION pmax VALUES LESS THAN MAXVALUE);
gdb> br Item_string::Item_string(char const*, unsigned int, charset_info_st*, Derivation, unsigned int)
gdb> c
gdb> set $addr=this
gdb> br Item_string::~Item_string() if this==$addr
gdb> c
mysql> ALTER TABLE t1 PARTITION BY RANGE(EXTRACT(DAY FROM a)) (PARTITION p VALUES LESS THAN (1), PARTITION pmax VALUES LESS THAN MAXVALUE);
gdb> br Item_extract::Item_extract(interval_type, Item*)
gdb> c
gdb> set $addr=this
gdb> br Item_string::~Item_string() if this==$addr
gdb> c
Description: Items created when parsing the partitioning expression in ALTER TABLE ... PARTITION are freed in closefrm(). However, if an error occurs before the actual creation of the .frm, closefrm() is obviously not called causing memory allocated by item tree corresponding to the partitioning expression to leak. How to repeat: mysql> CREATE TABLE t1 (a TIMESTAMP); gdb> br mysql_unpack_partition gdb> c mysql> ALTER TABLE t1 PARTITION BY RANGE("1") (PARTITION p VALUES LESS THAN (1), PARTITION pmax VALUES LESS THAN MAXVALUE); gdb> br Item_string::Item_string(char const*, unsigned int, charset_info_st*, Derivation, unsigned int) gdb> c gdb> set $addr=this gdb> br Item_string::~Item_string() if this==$addr gdb> c mysql> ALTER TABLE t1 PARTITION BY RANGE(EXTRACT(DAY FROM a)) (PARTITION p VALUES LESS THAN (1), PARTITION pmax VALUES LESS THAN MAXVALUE); gdb> br Item_extract::Item_extract(interval_type, Item*) gdb> c gdb> set $addr=this gdb> br Item_string::~Item_string() if this==$addr gdb> c