| Bug #48137 | procedure analyse() leaks memory when returning null | ||
|---|---|---|---|
| Submitted: | 19 Oct 2009 4:24 | Modified: | 26 Apr 2011 15:50 |
| Reporter: | Shane Bester (Platinum Quality Contributor) | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: General | Severity: | S2 (Serious) |
| Version: | 5.0.85,5.1.39,5.1.41, 5.5.8 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | Leak, memory leak, PROCEDURE ANALYSE | ||
[10 Nov 2010 2:10]
MySQL Verification Team
I disagree with the affort put into fixing this bug. Memory leaks are not a joking matter. They are near impossible to debug in live environments [unlike crashes, which are fairly basic]. The use-case is legitimate SQL requiring minimal select privs. The fix is likely trivial here.
[26 Apr 2011 15:50]
Paul DuBois
Noted in 5.1.58, 5.5.13, 5.6.3 changelogs. PROCEDURE ANALYZE() could leak memory for NULL results, and could return incorrect results if used with a LIMIT clause. CHANGESET - http://lists.mysql.com/commits/135391

Description: mysql> select distinctrow `a` -> from `t1` natural right outer join `t3`; +------+ | a | +------+ | NULL | +------+ 1 row in set (1.01 sec) 116 bytes in 1 blocks are definitely lost in loss record 4 of 13 at: malloc (vg_replace_malloc.c:195) by: proc_analyse_init( (sql_analyse.cc:74) by: setup_procedure (procedure.cc:93) by: JOIN::prepare (sql_select.cc:613) by: mysql_select (sql_select.cc:2377) by: handle_select (sql_select.cc:268) by: execute_sqlcom_select (sql_parse.cc:5011) by: mysql_execute_command(THD*) (sql_parse.cc:2206) by: mysql_parse (sql_parse.cc:5931) by: dispatch_command (sql_parse.cc:1213) by: do_command(THD*) (sql_parse.cc:854) by: handle_one_connection (sql_connect.cc:1127) How to repeat: run mysqld under valgrind then execute the sql: drop table if exists `t1`,`t3`; create table `t1`(`a` int)engine=myisam; create table `t3`(`b` int)engine=innodb; insert into `t3` values (1); select distinctrow `a` from `t1` natural right outer join `t3` procedure analyse(); Suggested fix: don't leak memory