diff --git a/libmariadb/libmariadb.c b/libmariadb/libmariadb.c index 982f8503..051200fc 100644 --- a/libmariadb/libmariadb.c +++ b/libmariadb/libmariadb.c @@ -2196,6 +2196,7 @@ static void mysql_close_options(MYSQL *mysql) my_free(mysql->options.ssl_cipher); if (mysql->options.extension) { + struct mysql_async_context *ctxt; my_free(mysql->options.extension->plugin_dir); my_free(mysql->options.extension->default_auth); my_free(mysql->options.extension->db_driver); @@ -2205,6 +2206,12 @@ static void mysql_close_options(MYSQL *mysql) my_free(mysql->options.extension->ssl_fp_list); if(hash_inited(&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); /* clear all pointer */ diff --git a/unittest/libmariadb/async.c b/unittest/libmariadb/async.c index fbdbc53e..4a947ab9 100644 --- a/unittest/libmariadb/async.c +++ b/unittest/libmariadb/async.c @@ -191,9 +191,19 @@ static int async1(MYSQL *my) 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[] = { {"async1", async1, TEST_CONNECTION_DEFAULT, 0, NULL, NULL}, + {"test_conc131", test_conc131, TEST_CONNECTION_NONE, 0, NULL, NULL}, {NULL, NULL, 0, 0, NULL, NULL} };