Merge pull request #32344 from nextcloud/fix/always-free-db-result-qbmapper-find-entities

Always free the DB result in QBMapper::findEntities
pull/32355/head
Joas Schilling 2022-05-12 11:05:03 +07:00 committed by GitHub
commit 7d218bfb0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 9 deletions

@ -334,16 +334,15 @@ abstract class QBMapper {
*/
protected function findEntities(IQueryBuilder $query): array {
$result = $query->executeQuery();
$entities = [];
while ($row = $result->fetch()) {
$entities[] = $this->mapRowToEntity($row);
try {
$entities = [];
while ($row = $result->fetch()) {
$entities[] = $this->mapRowToEntity($row);
}
return $entities;
} finally {
$result->closeCursor();
}
$result->closeCursor();
return $entities;
}