summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2020-08-05 22:39:09 +0200
committerGitHub <noreply@github.com>2020-08-05 22:39:09 +0200
commit519cd678eee6ab83dfdcd09f4cad1a86b0909114 (patch)
tree5fbbe24a8e7d4e202ac8e610c9aa3d7eca690d04 /lib/private
parent5cc978657efb44c124560f06d788f09edd81639e (diff)
parentf510da139f787f7b1f25ef1785e4161a9255a87a (diff)
downloadnextcloud-server-519cd678eee6ab83dfdcd09f4cad1a86b0909114.tar.gz
nextcloud-server-519cd678eee6ab83dfdcd09f4cad1a86b0909114.zip
Merge pull request #22008 from elijahnyp/OCImage_Leak_Fix
Ensured large image is unloaded from memory when generating previews
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Preview/Generator.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/private/Preview/Generator.php b/lib/private/Preview/Generator.php
index f7aed987d89..e47a7e5927c 100644
--- a/lib/private/Preview/Generator.php
+++ b/lib/private/Preview/Generator.php
@@ -192,6 +192,12 @@ class Generator {
}
}
+ // Free memory being used by the embedded image resource. Without this the image is kept in memory indefinitely.
+ // Garbage Collection does NOT free this memory. We have to do it ourselves.
+ if ($maxPreviewImage instanceof \OC_Image) {
+ $maxPreviewImage->destroy();
+ }
+
return $preview;
}