[CONC-173] Memory leak mysql_real_connect() when linking with mariadb_config --libs Created: 2016-04-17  Updated: 2016-04-18  Resolved: 2016-04-18

Status: Closed
Project: MariaDB Connector/C
Component/s: None
Affects Version/s: 3.0.0
Fix Version/s: 3.0.0

Type: Bug Priority: Major
Reporter: Jarosław Siebert Assignee: Georg Richter
Resolution: Fixed Votes: 0
Labels: None


 Description   

I try to use lgpl version of mysql c connector. When I link test program using:
mariadb_config --libs and mariadb_config --cflags, then I got memory leak.
When I link the same program using mysql_config --libs and mysql_config --cflags,
then there is no memory leak.
Is it a library bug or there is a bug in my test program?
My test function:

   for(;;) {
                MYSQL mysql;
                int arg;
                mysql_init(&mysql);
                mysql_options(&mysql, MYSQL_READ_DEFAULT_GROUP, "client");
                mysql_options(&mysql, MYSQL_OPT_COMPRESS, 0);
                mysql_options(&mysql, MYSQL_OPT_NAMED_PIPE, 0);
                arg = MYSQL_PROTOCOL_SOCKET;
                mysql_options(&mysql, MYSQL_OPT_PROTOCOL, &arg);
                if(!mysql_real_connect(&mysql, "localhost", DBUSER, DBPASS, DBNAME,
0, 0, 0))  {
                        fprintf(stderr, "Failed to connect to database: Error: %s\n", mysql_error(&mysql));
                        return 1;
                }
                mysql_close(&mysql);
        }
        return 0;

I monitor memory usage with:

while true; do ps -o rss $PID; sleep 1; done

Without mysql_real_connect() there is no memory leak.



 Comments   
Comment by Georg Richter [ 2016-04-18 ]

Thanks for your bug report.

Fixed in rev. c70128b50cadae81e87b6066a2d420c89bb86cdb

Generated at Thu Feb 08 03:03:24 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.