diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2022-05-12 09:51:37 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2022-05-12 09:51:37 +0200 |
commit | 1cd05a06fafcca6d115ec4e4b210704439c1ab14 (patch) | |
tree | c808869d25ccd902f21167e19f55909cbb5c2e3d /lib/public | |
parent | e11c5f21cfacb4a196e692bf01f80d487dd7a209 (diff) | |
download | nextcloud-server-1cd05a06fafcca6d115ec4e4b210704439c1ab14.tar.gz nextcloud-server-1cd05a06fafcca6d115ec4e4b210704439c1ab14.zip |
Always free the DB result in QBMapper::findEntities
Without this patch it only happened if the code ran through without any
errors. Now the result is also freed in the case of an error.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/public')
-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; } |