1
0
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:
Georg Richter
2024-04-29 10:57:12 +02:00
parent 7d0edc3dfa
commit 20fbb3c3b9

View File

@@ -127,7 +127,12 @@ void stmt_set_error(MYSQL_STMT *stmt,
pending result set */
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)
{
MYSQL_STMT *s= (MYSQL_STMT *)li_stmt->data;