Fix memory leak in PDOStatement::fetchAll()

Fixed memory leak while fetching data in PDOStatement::fetchAll().

Fixes #1567