summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorkroki/tomash@moonlight.intranet <>2006-08-09 13:37:20 +0400
committerkroki/tomash@moonlight.intranet <>2006-08-09 13:37:20 +0400
commit5c272816ca36e7ccb402ded339f4ffd2894ced5c (patch)
tree21c67f22e21375044ef6217a225616bac076de72 /tests
parent21f7f347762079fe907574fc73e6b549f4749d9e (diff)
parent4a461fdae3bbb7ce5afdc1b909899bcc6c6d93fe (diff)
downloadmariadb-git-5c272816ca36e7ccb402ded339f4ffd2894ced5c.tar.gz
Merge moonlight.intranet:/home/tomash/src/mysql_ab/tmp_merge
into moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.1-merge
Diffstat (limited to 'tests')
-rw-r--r--tests/mysql_client_test.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index eb5465d4d35..924f9169f5a 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -15227,6 +15227,51 @@ static void test_bug20152()
DIE_UNLESS(0==1);
}
}
+
+
+/*
+ Bug#21206: memory corruption when too many cursors are opened at once
+
+ Memory corruption happens when more than 1024 cursors are open
+ simultaneously.
+*/
+static void test_bug21206()
+{
+ const size_t cursor_count= 1025;
+
+ const char *create_table[]=
+ {
+ "DROP TABLE IF EXISTS t1",
+ "CREATE TABLE t1 (i INT)",
+ "INSERT INTO t1 VALUES (1), (2), (3)"
+ };
+ const char *query= "SELECT * FROM t1";
+
+ Stmt_fetch *fetch_array=
+ (Stmt_fetch*) calloc(cursor_count, sizeof(Stmt_fetch));
+
+ Stmt_fetch *fetch;
+
+ DBUG_ENTER("test_bug21206");
+ myheader("test_bug21206");
+
+ fill_tables(create_table, sizeof(create_table) / sizeof(*create_table));
+
+ for (fetch= fetch_array; fetch < fetch_array + cursor_count; ++fetch)
+ {
+ /* Init will exit(1) in case of error */
+ stmt_fetch_init(fetch, fetch - fetch_array, query);
+ }
+
+ for (fetch= fetch_array; fetch < fetch_array + cursor_count; ++fetch)
+ stmt_fetch_close(fetch);
+
+ free(fetch_array);
+
+ DBUG_VOID_RETURN;
+}
+
+
/*
Read and parse arguments and MySQL options from my.cnf
*/
@@ -15501,6 +15546,7 @@ static struct my_tests_st my_tests[]= {
{ "test_bug17667", test_bug17667 },
{ "test_mysql_insert_id", test_mysql_insert_id },
{ "test_bug19671", test_bug19671},
+ { "test_bug21206", test_bug21206},
{ 0, 0 }
};