summaryrefslogtreecommitdiff
path: root/sql-common
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2003-06-24 12:10:35 +0300
committerunknown <monty@narttu.mysql.fi>2003-06-24 12:10:35 +0300
commitfff1f663c2d55faa57aaeae29df11515772c1b0b (patch)
tree415b1821c33eac5fc78fcb02664dfd546daa9406 /sql-common
parent01450dbb79540c01e6b0381ce0760418dcdfc133 (diff)
downloadmariadb-git-fff1f663c2d55faa57aaeae29df11515772c1b0b.tar.gz
Fixed some new memory leaks
Updated VC++ files VC++Files/client/mysql.dsp: Update of VC++ files VC++Files/client/mysqlclient.dsp: Update of VC++ files VC++Files/libmysqld/examples/test_libmysqld.dsp: Update of VC++ files VC++Files/libmysqld/libmysqld.def: Update of VC++ files VC++Files/libmysqld/libmysqld.dsp: Update of VC++ files VC++Files/myisam/myisam.dsp: Update of VC++ files VC++Files/mysql.dsw: Update of VC++ files VC++Files/sql/mysqld.dsp: Update of VC++ files include/mysql.h: Add missing client functions to embedded server libmysql/libmysql.def: sort functions to enable comparison with libmysqld.def libmysqld/libmysqld.c: Add missing client functions to embedded server libmysqld/libmysqld.def: sort functions to enable comparison with libmysql.def Added missing functions myisam/mi_preload.c: Fixed compiler warning. Small code cleanup scripts/make_win_src_distribution.sh: Fixed typo Don't run zip in verbose mode scripts/mysql_create_system_tables.sh: Change so that localhost has full access (to make this like 4.0) scripts/mysql_fix_privilege_tables.sh: Allow on to run this from the source distribution sql-common/client.c: Fixed memory leak sql/item_sum.cc: Removed compiler warning sql/slave.cc: Cleanup sql/sql_client.cc: Portability fix sql/sql_help.cc: Fixed memory leak
Diffstat (limited to 'sql-common')
-rw-r--r--sql-common/client.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/sql-common/client.c b/sql-common/client.c
index 33f2b996971..721164c8301 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -2022,7 +2022,6 @@ my_bool mysql_reconnect(MYSQL *mysql)
}
mysql_init(&tmp_mysql);
tmp_mysql.options=mysql->options;
- bzero((char*) &mysql->options,sizeof(mysql->options));
tmp_mysql.rpl_pivot = mysql->rpl_pivot;
if (!mysql_real_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd,
mysql->db, mysql->port, mysql->unix_socket,
@@ -2033,7 +2032,9 @@ my_bool mysql_reconnect(MYSQL *mysql)
strmov(mysql->net.sqlstate, tmp_mysql.net.sqlstate);
DBUG_RETURN(1);
}
- tmp_mysql.free_me=mysql->free_me;
+ tmp_mysql.free_me= mysql->free_me;
+ /* Don't free options as these are now used in tmp_mysql */
+ bzero((char*) &mysql->options,sizeof(mysql->options));
mysql->free_me=0;
mysql_close(mysql);
*mysql=tmp_mysql;
@@ -2070,9 +2071,6 @@ mysql_select_db(MYSQL *mysql, const char *db)
static void mysql_close_free_options(MYSQL *mysql)
{
- my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->passwd,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR));
my_free(mysql->options.user,MYF(MY_ALLOW_ZERO_PTR));
my_free(mysql->options.host,MYF(MY_ALLOW_ZERO_PTR));
my_free(mysql->options.password,MYF(MY_ALLOW_ZERO_PTR));
@@ -2099,14 +2097,17 @@ static void mysql_close_free_options(MYSQL *mysql)
if (mysql->options.shared_memory_base_name != def_shared_memory_base_name)
my_free(mysql->options.shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
#endif /* HAVE_SMEM */
- bzero((char*) &mysql->options,sizeof(mysql->options));
+ bzero((char*) &mysql->options,sizeof(mysql->options));
}
static void mysql_close_free(MYSQL *mysql)
{
- /* Clear pointers for better safety */
my_free((gptr) mysql->host_info,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mysql->passwd,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR));
+ /* Clear pointers for better safety */
mysql->host_info=mysql->user=mysql->passwd=mysql->db=0;
}