1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

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)
This commit is contained in:
unknown
2006-02-01 20:35:16 +01:00
parent c98077d610
commit 1e686ae770
2 changed files with 38 additions and 0 deletions

View File

@ -4628,6 +4628,12 @@ my_bool STDCALL mysql_stmt_reset(MYSQL_STMT *stmt)
/* If statement hasnt been prepared there is nothing to reset */
if ((int) stmt->state < (int) MYSQL_STMT_PREPARE_DONE)
DBUG_RETURN(0);
if (!stmt->mysql)
{
/* mysql can be reset in mysql_close called from mysql_reconnect */
set_stmt_error(stmt, CR_SERVER_LOST, unknown_sqlstate);
DBUG_RETURN(1);
}
mysql= stmt->mysql->last_used_con;
int4store(buff, stmt->stmt_id); /* Send stmt id to server */