From 3f25c4228a8f505a000c1ea5751062606247349a Mon Sep 17 00:00:00 2001 From: Keyur Date: Mon, 8 Aug 2016 23:34:00 +0000 Subject: Fix bug 72788: Invalid memory access when database_object_handle is undefined. Also fix memory leak in dbh_free when using persistent PDO connections. --- ext/pdo_mysql/mysql_statement.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ext/pdo_mysql/mysql_statement.c') diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c index b141de79ef..4a2146dd16 100644 --- a/ext/pdo_mysql/mysql_statement.c +++ b/ext/pdo_mysql/mysql_statement.c @@ -88,7 +88,8 @@ static int pdo_mysql_stmt_dtor(pdo_stmt_t *stmt) /* {{{ */ } #endif - if (IS_OBJ_VALID(EG(objects_store).object_buckets[Z_OBJ_HANDLE(stmt->database_object_handle)]) + if (!Z_ISUNDEF(stmt->database_object_handle) + && IS_OBJ_VALID(EG(objects_store).object_buckets[Z_OBJ_HANDLE(stmt->database_object_handle)]) && (!(GC_FLAGS(Z_OBJ(stmt->database_object_handle)) & IS_OBJ_FREE_CALLED))) { while (mysql_more_results(S->H->server)) { MYSQL_RES *res; -- cgit v1.2.1