Bug #29247 Double free in libmysqlclient_r when mysql restarted.

If one sets MYSQL_READ_DEFAULTS_FILE and MYSQL_READ_DEFAULT_GROUP options
after mysql_real_connect() called with that MYSQL instance,
these options will affect next mysql_reconnect then.
As we use a copy of the original MYSQL object inside mysql_reconnect,
and mysql_real_connect frees options.my_cnf_file and _group strings,
we will free these twice when we execute mysql_reconnect with the
same MYSQL for the second time.

I don't think we should ever read defaults files handling mysql_reconnect.
So i just set them to 0 for the temporary MYSQL object there/
parent 78c53ea3
...@@ -2451,6 +2451,7 @@ my_bool mysql_reconnect(MYSQL *mysql) ...@@ -2451,6 +2451,7 @@ my_bool mysql_reconnect(MYSQL *mysql)
} }
mysql_init(&tmp_mysql); mysql_init(&tmp_mysql);
tmp_mysql.options= mysql->options; tmp_mysql.options= mysql->options;
tmp_mysql.options.my_cnf_file= tmp_mysql.options.my_cnf_group= 0;
tmp_mysql.rpl_pivot= mysql->rpl_pivot; tmp_mysql.rpl_pivot= mysql->rpl_pivot;
if (!mysql_real_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd, if (!mysql_real_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment