From 0c19e44a61229fe1376c8436b8a73e974b424539 Mon Sep 17 00:00:00 2001
From: Robin Appelman <icewind@owncloud.com>
Date: Mon, 26 Mar 2012 22:28:40 +0200
Subject: [PATCH] some more memory cleanup in OC_Image

---
 lib/image.php | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/image.php b/lib/image.php
index 60a714880d..62f35b4fc9 100644
--- a/lib/image.php
+++ b/lib/image.php
@@ -526,6 +526,7 @@ class OC_Image {
 			imagedestroy($process);
 			return false;
 		}
+		imagedestroy($this->resource);
 		$this->resource = $process;
 		return true;
 	}
@@ -558,7 +559,14 @@ class OC_Image {
 			imagedestroy($process);
 			return false;
 		}
+		imagedestroy($this->resource);
 		$this->resource = $process;
 		return true;
 	}
+
+	public function __destruct(){
+		if(is_resource($this->resource)){
+			imagedestroy($this->resource);
+		}
+	}
 }
-- 
GitLab