You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-08 14:02:17 +03:00
Avoid possible crash if connection was closed
Before checking pending result sets in prepared statements, we need to check if the connection was already closed or resetted by checking stmt->mysql. In case of NULL we return false, since there are no more pending result sets.
This commit is contained in:
@@ -127,7 +127,12 @@ void stmt_set_error(MYSQL_STMT *stmt,
|
|||||||
pending result set */
|
pending result set */
|
||||||
static my_bool madb_have_pending_results(MYSQL_STMT *stmt)
|
static my_bool madb_have_pending_results(MYSQL_STMT *stmt)
|
||||||
{
|
{
|
||||||
LIST *li_stmt= stmt->mysql->stmts;
|
LIST *li_stmt;
|
||||||
|
|
||||||
|
if (!stmt->mysql)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
li_stmt= stmt->mysql->stmts;
|
||||||
for (;li_stmt;li_stmt= li_stmt->next)
|
for (;li_stmt;li_stmt= li_stmt->next)
|
||||||
{
|
{
|
||||||
MYSQL_STMT *s= (MYSQL_STMT *)li_stmt->data;
|
MYSQL_STMT *s= (MYSQL_STMT *)li_stmt->data;
|
||||||
|
Reference in New Issue
Block a user