Bug #1772 memory leak in mysqlclient.lib (mysql_close)

Submitted: 6 Nov 2003 16:01 Modified: 16 Dec 2003 17:40
Reporter: Pascal Drecker Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:4.0.16 OS:Windows (Windows XP)
Assigned to: CPU Architecture:Any

[6 Nov 2003 16:01] Pascal Drecker
Description:
Memory leak )-: in the following code:
--------------------------------------
MYSQL *pMySQL;

pMySQL = mysql_init(NULL);

if (pMySQL == NULL)
    return -1;

mysql_close(pMySQL);
--------------------------------------
(compiled with MS Visual Studio 6 SP5)

#
# mysqlclient.lib (4.0.16)
#
Detected memory leaks!
Dumping objects ->
{178} normal block at 0x006C4E20, 64 bytes long.
 Data: <        h   («  > 00 00 00 00 00 00 00 00 68 07 00 00 28 AB 16 00 
Object dump complete.

#
# mysqlclient.lib (4.0.13)
#
Detected memory leaks!
Dumping objects ->
{178} normal block at 0x006C4E20, 60 bytes long.
 Data: <        h   («  > 00 00 00 00 00 00 00 00 68 07 00 00 28 AB 16 00 
Object dump complete.

#
# Best Regards from the University Greifswald (Germany)
# Pascal Drecker
#

How to repeat:
[7 Nov 2003 4:07] Pascal Drecker
Another TWO memory leaks:
--------------------------------------
MYSQL *pMySQL;

pMySQL = mysql_init(NULL);

if (pMySQL == NULL)
    return -1;

if (mysql_real_connect(pMySQL, "localhost", "root", "", "not_available", 0, NULL, 0) == NULL)
{
    mysql_close(pMySQL);
    return -1;
}

mysql_close(pMySQL);
--------------------------------------
#
# pointer address of pMySQL = 0x006C4680
#

#
# mysqlclient.lib (4.0.16)
#
Dumping objects ->
{198} normal block at 0x00369F98, 4088 bytes long.
 Data: <    X   ø   ÍÍÍÍ> 00 00 00 00 58 0D 00 00 F8 0F 00 00 CD CD CD CD 
{191} normal block at 0x006C4590, 64 bytes long.
 Data: <ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ> CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD 
{178} normal block at 0x006C4E20, 64 bytes long.
 Data: <        h   («  > 00 00 00 00 00 00 00 00 68 07 00 00 28 AB 16 00 
Object dump complete.
#
# Best Regards,
# Pascal Drecker
#
[9 Nov 2003 1:11] Pascal Drecker
Sorry, the first reported memory leak was my mistake. I did not mentioned the function 'mysql_thread_end' because mysql_thread_init is called automatically.

Perhaps, as 'mysql_init' and 'mysql_connect' (default mysqlclient.lib) automatically call 'mysql_thread_init', these function description could be extended by a little note for the function 'mysql_thread_end'.

My mistake:
----------------------------
{178} normal block at 0x006C4E20, 64 bytes long.
 Data: <        h   («  > 00 00 00 00 00 00 00 00 68 07 00 00 28 AB 16 00
----------------------------

After the function call 'mysql_real_connect' the other TWO memory leaks still exist!

Best Regards,
Pascal
[16 Nov 2003 17:40] MySQL Verification Team
Could you please provide us with your complete *.dsw project stuff test.
I will test it against Purify Windows.

If yes please upload the zip file at ftp://support.mysql.com/pub/mysql/secret/
with a name identifying this bug report.
[14 Feb 2005 22:54] 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".

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.