fix some warnings

parent 852508a4
...@@ -947,7 +947,7 @@ static int add_init_command(struct st_mysql_options *options, const char *cmd) ...@@ -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))) || 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)); my_free(tmp, MYF(MY_ALLOW_ZERO_PTR));
return 1; return 1;
...@@ -2623,8 +2623,13 @@ mysql_close(MYSQL *mysql) ...@@ -2623,8 +2623,13 @@ mysql_close(MYSQL *mysql)
my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR));
if (mysql->options.init_commands) if (mysql->options.init_commands)
{ {
delete_dynamic(mysql->options.init_commands); DYNAMIC_ARRAY *init_commands= mysql->options.init_commands;
my_free((char*)mysql->options.init_commands,MYF(MY_WME)); 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 #ifdef HAVE_OPENSSL
mysql_ssl_free(mysql); mysql_ssl_free(mysql);
......
...@@ -463,7 +463,7 @@ static int add_init_command(struct st_mysql_options *options, const char *cmd) ...@@ -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))) || 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)); my_free(tmp, MYF(MY_ALLOW_ZERO_PTR));
return 1; return 1;
...@@ -1152,8 +1152,13 @@ mysql_close(MYSQL *mysql) ...@@ -1152,8 +1152,13 @@ mysql_close(MYSQL *mysql)
my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR));
if (mysql->options.init_commands) if (mysql->options.init_commands)
{ {
delete_dynamic(mysql->options.init_commands); DYNAMIC_ARRAY *init_commands= mysql->options.init_commands;
my_free((char*)mysql->options.init_commands,MYF(MY_WME)); 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 */ /* Clear pointers for better safety */
mysql->host_info=mysql->user=mysql->passwd=mysql->db=0; 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