Bug #50993 mem-leak if MySQL pre-4.1 client connects to MySQL Proxy
Submitted: 8 Feb 2010 13:26 Modified: 20 Apr 2010 16:05
Reporter: Jan Kneschke Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Proxy: Core Severity:S3 (Non-critical)
Version:0.7.x, 0.8.0 OS:Any
Assigned to: CPU Architecture:Any

[8 Feb 2010 13:26] Jan Kneschke
Description:
The mysql-4.0 test in tests/suite/base/t/ shows a mem-leak in:

==17386== 76 (24 direct, 52 indirect) bytes in 1 blocks are definitely lost in loss record 39 of 53
==17386==    at 0x4023F5B: calloc (vg_replace_malloc.c:418)
==17386==    by 0x409E26B: g_malloc0 (gmem.c:151)
==17386==    by 0x4123735: network_mysqld_auth_response_new (network-mysqld-packet.c:1154)
==17386==    by 0x4766149: proxy_read_auth (proxy-plugin.c:632)
==17386==    by 0x411B15E: plugin_call (network-mysqld.c:699)
==17386==    by 0x411C715: network_mysqld_con_handle (network-mysqld.c:1056)
...

How to repeat:
Use a mysql client from MySQL 4.0 and connect to the MySQL Proxy while it runs under valgrind. 

Suggested fix:
=== modified file 'plugins/proxy/proxy-plugin.c'
--- plugins/proxy/proxy-plugin.c        revid:jan@mysql.com-20100208112255-03hpy4hbwcqe3e1b
+++ plugins/proxy/proxy-plugin.c        revid:jan@mysql.com-20100208112310-n5dkhuyid0f5z7ll
@@ -640,6 +640,7 @@
        if (!(auth->capabilities & CLIENT_PROTOCOL_41)) {
                /* should use packet-id 0 */
                network_mysqld_queue_append(con->client, con->client->send_queue, C("\xff\xd7\x07" "4.0 protocol is not supported"));
+               network_mysqld_auth_response_free(auth);
                return NETWORK_SOCKET_ERROR;
        }
[9 Feb 2010 8:40] Sveta Smirnova
Thank you for the report.

I can not repeat described behavior using valgrind-3.5.0. Which additional circumstances should I use?
[10 Mar 2010 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[30 Mar 2010 16:18] Enterprise Tools JIRA Robot
Kay Roepke writes: 
fixed on launchpad (also released in 0.8):

Revision ID: jan@mysql.com-20100208112310-xuhr3423clpc3ntp
fixed mem-leak on 4.0 clients connect
[20 Apr 2010 16:05] MC Brown
A note has been added to the 0.8.0 changelog: 

        A memory leak could occur in MySQL Proxy if MySQL v4.0 or
        earlier clients connected to the proxy.