summaryrefslogtreecommitdiff
path: root/sql-common/client.c
diff options
context:
space:
mode:
authorholyfoot/hf@mysql.com/hfmain.(none) <>2007-06-25 16:40:29 +0500
committerholyfoot/hf@mysql.com/hfmain.(none) <>2007-06-25 16:40:29 +0500
commit43e0e17ae637ac5984905f7433d38bfe0cf7e9bc (patch)
treea49c784110d227a525c09288e8fadcb0def9f609 /sql-common/client.c
parent78c53ea32ebf8b2a2b5ce1bf288b366d6eca0800 (diff)
downloadmariadb-git-43e0e17ae637ac5984905f7433d38bfe0cf7e9bc.tar.gz
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/
Diffstat (limited to 'sql-common/client.c')
-rw-r--r--sql-common/client.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sql-common/client.c b/sql-common/client.c
index 3e5ceb1a738..c18c56e9c47 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -2451,6 +2451,7 @@ my_bool mysql_reconnect(MYSQL *mysql)
}
mysql_init(&tmp_mysql);
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;
if (!mysql_real_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd,