diff options
author | unknown <andrey@lmy004.> | 2006-02-01 20:35:16 +0100 |
---|---|---|
committer | unknown <andrey@lmy004.> | 2006-02-01 20:35:16 +0100 |
commit | 1e686ae7702d297cc9fd261c42864653f4fdd7b3 (patch) | |
tree | 59375d95c601aec43e46d08deb88028599227821 /tests | |
parent | c98077d6101c7dc2b364e0536b1e675dc76d8f0f (diff) | |
download | mariadb-git-1e686ae7702d297cc9fd261c42864653f4fdd7b3.tar.gz |
fix for bug #12744 (MYSQL_STMT operations cause seg fault after connection reset)
libmysql/libmysql.c:
stmt->mysql could be 0x0 if the connection has failed between prepare and execute
or any other operation. thus if the user decides to use mysql_stmt_reset()
we should not segfault.
tests/mysql_client_test.c:
test for bug #12744 (MYSQL_STMT operations cause seg fault after connection reset)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mysql_client_test.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 91c2ab9205d..dbc2f582466 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -11706,6 +11706,37 @@ static void test_bug12001() DIE_UNLESS(res==1); } +static void test_bug12744() +{ + MYSQL_STMT *prep_stmt = NULL; + int rc; + myheader("test_bug12744"); + + prep_stmt= mysql_stmt_init(mysql); + rc= mysql_stmt_prepare(prep_stmt, "SELECT 1", 8); + DIE_UNLESS(rc==0); + + rc= mysql_kill(mysql, mysql_thread_id(mysql)); + DIE_UNLESS(rc==0); + + if (rc= mysql_stmt_execute(prep_stmt)) + { + if (rc= mysql_stmt_reset(prep_stmt)) + printf("OK!\n"); + else + { + printf("Error!"); + DIE_UNLESS(1==0); + } + } + else + { + fprintf(stderr, "expected error but no error occured\n"); + DIE_UNLESS(1==0); + } + rc= mysql_stmt_close(prep_stmt); +} + /* Bug#11718: query with function, join and order by returns wrong type */ @@ -12054,6 +12085,7 @@ static struct my_tests_st my_tests[]= { { "test_bug8378", test_bug8378 }, { "test_bug9735", test_bug9735 }, { "test_bug11183", test_bug11183 }, + { "test_bug12744", test_bug12744 }, { "test_bug12001", test_bug12001 }, { "test_bug11718", test_bug11718 }, { "test_bug12925", test_bug12925 }, |