Prevent crash in case of SQL error

This commit is contained in:
Dmitry Stogov 2014-05-19 11:52:33 +04:00
parent 4ea10696e8
commit 4e521c92ec

View file

@ -404,7 +404,9 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
/* ensure that we free any previous unfetched results */
#ifndef PDO_USE_MYSQLND
if (S->stmt) {
stmt->column_count = (int)mysql_num_fields(S->result);
if (S->result) {
stmt->column_count = (int)mysql_num_fields(S->result);
}
mysql_stmt_free_result(S->stmt);
}
#endif