Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2022-05-12 10:51:37 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2022-05-12 10:51:37 +0300
commit1cd05a06fafcca6d115ec4e4b210704439c1ab14 (patch)
treec808869d25ccd902f21167e19f55909cbb5c2e3d /lib
parente11c5f21cfacb4a196e692bf01f80d487dd7a209 (diff)
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')
-rw-r--r--lib/public/AppFramework/Db/QBMapper.php17
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;
}