Commit a637e9c4 authored by unknown's avatar unknown

Merge vvagin@work.mysql.com:/home/bk/mysql-4.1

into eagle.mysql.r18.ru:/home/vva/work/MANY_INIT_COMMANDS/4.1

parents 2a646158 d1856800
......@@ -947,7 +947,7 @@ static int add_init_command(struct st_mysql_options *options, const char *cmd)
}
if (!(tmp= my_strdup(cmd,MYF(MY_WME))) ||
insert_dynamic(options->init_commands, (byte*)&tmp))
insert_dynamic(options->init_commands, (gptr)&tmp))
{
my_free(tmp, MYF(MY_ALLOW_ZERO_PTR));
return 1;
......@@ -2623,8 +2623,13 @@ mysql_close(MYSQL *mysql)
my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR));
if (mysql->options.init_commands)
{
delete_dynamic(mysql->options.init_commands);
my_free((char*)mysql->options.init_commands,MYF(MY_WME));
DYNAMIC_ARRAY *init_commands= mysql->options.init_commands;
char **ptr= (char**)init_commands->buffer;
char **end= ptr + init_commands->elements;
for (; ptr<end; ptr++)
my_free(*ptr,MYF(MY_WME));
delete_dynamic(init_commands);
my_free((char*)init_commands,MYF(MY_WME));
}
#ifdef HAVE_OPENSSL
mysql_ssl_free(mysql);
......
......@@ -463,7 +463,7 @@ static int add_init_command(struct st_mysql_options *options, const char *cmd)
}
if (!(tmp= my_strdup(cmd,MYF(MY_WME))) ||
insert_dynamic(options->init_commands, (byte*)&tmp))
insert_dynamic(options->init_commands, (gptr)&tmp))
{
my_free(tmp, MYF(MY_ALLOW_ZERO_PTR));
return 1;
......@@ -1152,8 +1152,13 @@ mysql_close(MYSQL *mysql)
my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR));
if (mysql->options.init_commands)
{
delete_dynamic(mysql->options.init_commands);
my_free((char*)mysql->options.init_commands,MYF(MY_WME));
DYNAMIC_ARRAY *init_commands= mysql->options.init_commands;
char **ptr= (char**)init_commands->buffer;
char **end= ptr + init_commands->elements;
for (; ptr<end; ptr++)
my_free(*ptr,MYF(MY_WME));
delete_dynamic(init_commands);
my_free((char*)init_commands,MYF(MY_WME));
}
/* Clear pointers for better safety */
mysql->host_info=mysql->user=mysql->passwd=mysql->db=0;
......
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