#At file:///home/gluh/MySQL/mysql-5.0-bugteam/ based on revid:satya.bn@stripped
2808 Sergey Glukhov 2009-09-04
Bug#45989 memory leak after explain encounters an error in the query
Memory allocated in TMP_TABLE_PARAM::copy_field is not cleaned up.
The fix is to clean up TMP_TABLE_PARAM::copy_field array in JOIN::destroy.
@ mysql-test/r/explain.result
test result
@ mysql-test/t/explain.test
test case
@ sql/sql_select.cc
Memory allocated in TMP_TABLE_PARAM::copy_field is not cleaned up.
The fix is to clean up TMP_TABLE_PARAM::copy_field array in JOIN::destroy.
modified:
mysql-test/r/explain.result
mysql-test/t/explain.test
sql/sql_select.cc
=== modified file 'mysql-test/r/explain.result'
--- a/mysql-test/r/explain.result 2009-06-11 11:49:04 +0000
+++ b/mysql-test/r/explain.result 2009-09-04 07:20:53 +0000
@@ -159,3 +159,11 @@ CREATE TABLE t1 (a INT PRIMARY KEY);
EXPLAIN EXTENDED SELECT COUNT(a) FROM t1 USE KEY(a);
ERROR HY000: Key 'a' doesn't exist in table 't1'
DROP TABLE t1;
+CREATE TABLE t1(a LONGTEXT);
+INSERT INTO t1 VALUES (repeat('a',@@global.max_allowed_packet));
+INSERT INTO t1 VALUES (repeat('b',@@global.max_allowed_packet));
+EXPLAIN SELECT DISTINCT 1 FROM t1,
+(SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) as d1
+WHERE t1.a = d1.a;
+ERROR 42S22: Unknown column 'd1.a' in 'where clause'
+DROP TABLE t1;
=== modified file 'mysql-test/t/explain.test'
--- a/mysql-test/t/explain.test 2009-06-11 11:49:04 +0000
+++ b/mysql-test/t/explain.test 2009-09-04 07:20:53 +0000
@@ -135,5 +135,16 @@ EXPLAIN EXTENDED SELECT COUNT(a) FROM t1
DROP TABLE t1;
+#
+# Bug#45989 memory leak after explain encounters an error in the query
+#
+CREATE TABLE t1(a LONGTEXT);
+INSERT INTO t1 VALUES (repeat('a',@@global.max_allowed_packet));
+INSERT INTO t1 VALUES (repeat('b',@@global.max_allowed_packet));
+--error ER_BAD_FIELD_ERROR
+EXPLAIN SELECT DISTINCT 1 FROM t1,
+ (SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) as d1
+ WHERE t1.a = d1.a;
+DROP TABLE t1;
# End of 5.0 tests.
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2009-08-27 11:40:42 +0000
+++ b/sql/sql_select.cc 2009-09-04 07:20:53 +0000
@@ -2176,7 +2176,7 @@ JOIN::destroy()
}
}
tmp_join->tmp_join= 0;
- tmp_table_param.copy_field=0;
+ tmp_table_param.cleanup();
DBUG_RETURN(tmp_join->destroy());
}
cond_equal= 0;
Attachment: [text/bzr-bundle] bzr/sergey.glukhov@sun.com-20090904072053-quchrnpayidj0eyx.bundle
Thread |
---|
• bzr commit into mysql-5.0-bugteam branch (Sergey.Glukhov:2808)Bug#45989 | Sergey Glukhov | 4 Sep |