1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-08 14:02:17 +03:00

10.2-integration fixes:

- always send COM_STMT_RESET if specified
- prevent double free of context buffer
This commit is contained in:
Georg Richter
2016-03-10 14:02:30 +01:00
parent 3cfc5f8654
commit 06e5422715
3 changed files with 7 additions and 8 deletions

View File

@@ -101,9 +101,11 @@ static int ma_net_write_buff(NET *net,const char *packet, size_t len);
int ma_net_init(NET *net, MARIADB_PVIO* pvio)
{
if (!(net->buff=(uchar*) calloc(1, net_buffer_length)))
if (!(net->buff=(uchar*) malloc(net_buffer_length)))
return 1;
memset(net->buff, 0, net_buffer_length);
if (!net->extension)
{
printf("Fatal\n");

View File

@@ -1516,8 +1516,6 @@ error:
end_server(mysql);
/* only free the allocated memory, user needs to call mysql_close */
mysql_close_memory(mysql);
if (!(((ulong) client_flag) & CLIENT_REMEMBER_OPTIONS))
mysql_close_options(mysql);
return(0);
}
@@ -1786,10 +1784,11 @@ static void mysql_close_options(MYSQL *mysql)
if (mysql->options.extension)
{
struct mysql_async_context *ctxt;
if ((ctxt = mysql->options.extension->async_context) != 0)
if ((ctxt = mysql->options.extension->async_context))
{
my_context_destroy(&ctxt->async_context);
free(ctxt);
mysql->options.extension->async_context= 0;
}
free(mysql->options.extension->plugin_dir);
free(mysql->options.extension->default_auth);

View File

@@ -1687,7 +1687,6 @@ static my_bool madb_reset_stmt(MYSQL_STMT *stmt, unsigned int flags)
}
}
if (flags & MADB_RESET_SERVER)
{
/* reset statement on server side */
@@ -1760,7 +1759,6 @@ static my_bool mysql_stmt_internal_reset(MYSQL_STMT *stmt, my_bool is_close)
stmt->mysql->status= MYSQL_STATUS_READY;
}
}
if (!stmt->execute_count)
if (!is_close)
ret= madb_reset_stmt(stmt, MADB_RESET_SERVER);
}