diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2022-05-12 12:05:03 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-12 12:05:03 +0300 |
commit | 7d218bfb0a51147fafd673424f019444056d31b6 (patch) | |
tree | 3bdf7cff71a7e0322e11bb5485d6cdd215e36e6f | |
parent | fc1db22629e33f3550daab0c737493ad21b3a8a7 (diff) | |
parent | 1cd05a06fafcca6d115ec4e4b210704439c1ab14 (diff) |
Merge pull request #32344 from nextcloud/fix/always-free-db-result-qbmapper-find-entities
Always free the DB result in QBMapper::findEntities
-rw-r--r-- | lib/public/AppFramework/Db/QBMapper.php | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/public/AppFramework/Db/QBMapper.php b/lib/public/AppFramework/Db/QBMapper.php index fa753a09dcf..2491fd83f4a 100644 --- a/lib/public/AppFramework/Db/QBMapper.php +++ b/lib/public/AppFramework/Db/QBMapper.php @@ -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; } |