You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-08 14:02:17 +03:00
Fix for bug CONC-131:
Free async context when closing options (mysql_options_close)
This commit is contained in:
@@ -2195,6 +2195,7 @@ static void mysql_close_options(MYSQL *mysql)
|
|||||||
my_free(mysql->options.ssl_cipher);
|
my_free(mysql->options.ssl_cipher);
|
||||||
if (mysql->options.extension)
|
if (mysql->options.extension)
|
||||||
{
|
{
|
||||||
|
struct mysql_async_context *ctxt;
|
||||||
my_free(mysql->options.extension->plugin_dir);
|
my_free(mysql->options.extension->plugin_dir);
|
||||||
my_free(mysql->options.extension->default_auth);
|
my_free(mysql->options.extension->default_auth);
|
||||||
my_free(mysql->options.extension->db_driver);
|
my_free(mysql->options.extension->db_driver);
|
||||||
@@ -2204,6 +2205,12 @@ static void mysql_close_options(MYSQL *mysql)
|
|||||||
my_free(mysql->options.extension->ssl_fp_list);
|
my_free(mysql->options.extension->ssl_fp_list);
|
||||||
if(hash_inited(&mysql->options.extension->connect_attrs))
|
if(hash_inited(&mysql->options.extension->connect_attrs))
|
||||||
hash_free(&mysql->options.extension->connect_attrs);
|
hash_free(&mysql->options.extension->connect_attrs);
|
||||||
|
if ((ctxt = mysql->options.extension->async_context) != 0)
|
||||||
|
{
|
||||||
|
my_context_destroy(&ctxt->async_context);
|
||||||
|
my_free(ctxt);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
my_free(mysql->options.extension);
|
my_free(mysql->options.extension);
|
||||||
/* clear all pointer */
|
/* clear all pointer */
|
||||||
|
@@ -191,9 +191,19 @@ static int async1(MYSQL *my)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int test_conc131(MYSQL *my)
|
||||||
|
{
|
||||||
|
/* this test needs to run under valgrind */
|
||||||
|
MYSQL *mysql=mysql_init(NULL);
|
||||||
|
mysql_options(mysql, MYSQL_OPT_NONBLOCK, 0);
|
||||||
|
mysql_close(mysql);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
struct my_tests_st my_tests[] = {
|
struct my_tests_st my_tests[] = {
|
||||||
{"async1", async1, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
{"async1", async1, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||||
|
{"test_conc131", test_conc131, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
||||||
{NULL, NULL, 0, 0, NULL, NULL}
|
{NULL, NULL, 0, 0, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user