summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorElijah Martin-Merrill <elijah@nyp-itsours.com>2020-07-27 10:52:44 -0400
committerElijah Martin-Merrill <elijah@nyp-itsours.com>2020-07-27 10:52:44 -0400
commit56ed563b0c02834c1b3fffb839da25a2918ec7e8 (patch)
tree37f7a9af104e5edcb4aefe835599f620cdf77a1d /lib/private
parent4cac0f6895cf4bda4dda0b7cb3b843546eb0a952 (diff)
downloadnextcloud-server-56ed563b0c02834c1b3fffb839da25a2918ec7e8.tar.gz
nextcloud-server-56ed563b0c02834c1b3fffb839da25a2918ec7e8.zip
fix memory leak caused by not destroying image in Preview/Generate.php
Signed-off-by: Elijah Martin-Merrill <elijah@nyp-itsours.com>
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..45e991d551d 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 IImage) {
+ $maxPreviewImage->destroy();
+ }
+
return $preview;
}