mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-16093 Memory leak with triggers
Problem was that blob memory allocated in Table_trigger_list was not properly freed
This commit is contained in:
@ -2306,4 +2306,15 @@ CREATE TABLE t1 (i INT);
|
||||
insert into t2 value (2);
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1,t2,t3;
|
||||
End of 10.1 tests.
|
||||
#
|
||||
# MDEV-16093
|
||||
# Assertion `global_status_var.global_memory_used == 0' failed or
|
||||
# bytes lost after inserting into table with non-null blob and trigger
|
||||
#
|
||||
CREATE TABLE t1 (b BLOB NOT NULL);
|
||||
CREATE TRIGGER tr BEFORE UPDATE ON t1 FOR EACH ROW BEGIN END;
|
||||
INSERT INTO t1 VALUES ('foo');
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 10.1 tests.
|
||||
#
|
||||
|
@ -2656,5 +2656,17 @@ insert into t2 value (2);
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1,t2,t3;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-16093
|
||||
--echo # Assertion `global_status_var.global_memory_used == 0' failed or
|
||||
--echo # bytes lost after inserting into table with non-null blob and trigger
|
||||
--echo #
|
||||
|
||||
--echo End of 10.1 tests.
|
||||
CREATE TABLE t1 (b BLOB NOT NULL);
|
||||
CREATE TRIGGER tr BEFORE UPDATE ON t1 FOR EACH ROW BEGIN END;
|
||||
INSERT INTO t1 VALUES ('foo');
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.1 tests.
|
||||
--echo #
|
||||
|
@ -614,6 +614,7 @@ end:
|
||||
#endif /* WITH_WSREP */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Build stmt_query to write it in the bin-log
|
||||
and get the trigger definer.
|
||||
@ -1061,6 +1062,11 @@ Table_triggers_list::~Table_triggers_list()
|
||||
for (int j= 0; j < (int)TRG_ACTION_MAX; j++)
|
||||
delete bodies[i][j];
|
||||
|
||||
/* Free blobs used in insert */
|
||||
if (record0_field)
|
||||
for (Field **fld_ptr= record0_field; *fld_ptr; fld_ptr++)
|
||||
(*fld_ptr)->free();
|
||||
|
||||
if (record1_field)
|
||||
for (Field **fld_ptr= record1_field; *fld_ptr; fld_ptr++)
|
||||
delete *fld_ptr;
|
||||
|
Reference in New Issue
Block a user