From 7038c647e16e0aef3eb3fe6e8197a9ccd037d426 Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Thu, 27 Oct 2005 17:25:31 +0000 Subject: [PATCH] - free S->stmt - return correct value from the cursor_closer - make sure S->stmt is NULL'ed --- ext/pdo_mysql/mysql_statement.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c index 9a48b128a0..e8d1728598 100755 --- a/ext/pdo_mysql/mysql_statement.c +++ b/ext/pdo_mysql/mysql_statement.c @@ -221,6 +221,12 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC) int ret; /* ensure that we free any previous unfetched results */ +#if HAVE_MYSQL_STMT_PREPARE + if (S->stmt) { + mysql_stmt_free_result(S->stmt); + S->stmt = NULL; + } +#endif if (S->result) { mysql_free_result(S->result); S->result = NULL; @@ -525,7 +531,9 @@ static int pdo_mysql_stmt_cursor_closer(pdo_stmt_t *stmt TSRMLS_DC) pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data; #if HAVE_MYSQL_STMT_PREPARE if (S->stmt) { - return mysql_stmt_free_result(S->stmt); + int retval = mysql_stmt_free_result(S->stmt); + S->stmt = NULL; + return retval ? 0 : 1; } #endif if (S->result) { -- 2.50.1