You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-07 02:42:49 +03:00
Fix for CONC-117:
if reconnecting fails (e.g. server has gone) we don't freee memory associated with tmp_mysql.
This commit is contained in:
@@ -2030,6 +2030,7 @@ static my_bool mysql_reconnect(MYSQL *mysql)
|
|||||||
my_set_error(mysql, tmp_mysql.net.last_errno,
|
my_set_error(mysql, tmp_mysql.net.last_errno,
|
||||||
tmp_mysql.net.sqlstate,
|
tmp_mysql.net.sqlstate,
|
||||||
tmp_mysql.net.last_error);
|
tmp_mysql.net.last_error);
|
||||||
|
mysql_close(&tmp_mysql);
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -982,7 +982,27 @@ static int test_conc_114(MYSQL *mysql)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* run with valgrind */
|
||||||
|
static int test_conc117(MYSQL *mysql)
|
||||||
|
{
|
||||||
|
MYSQL *my= mysql_init(NULL);
|
||||||
|
FAIL_IF(!mysql_real_connect(my, hostname, username, password, schema,
|
||||||
|
port, socketname, 0), mysql_error(my));
|
||||||
|
|
||||||
|
mysql_kill(my, mysql_thread_id(my));
|
||||||
|
sleep(5);
|
||||||
|
|
||||||
|
strcpy(my->host, "A");
|
||||||
|
my->reconnect= 1;
|
||||||
|
|
||||||
|
mysql_query(my, "SET @a:=1");
|
||||||
|
mysql_close(my);
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
struct my_tests_st my_tests[] = {
|
struct my_tests_st my_tests[] = {
|
||||||
|
{"test_conc117", test_conc117, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||||
{"test_conc_114", test_conc_114, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
{"test_conc_114", test_conc_114, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||||
{"test_connect_attrs", test_connect_attrs, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
{"test_connect_attrs", test_connect_attrs, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||||
{"test_conc49", test_conc49, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
{"test_conc49", test_conc49, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||||
|
Reference in New Issue
Block a user