diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-08-13 22:41:33 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-08-13 22:41:33 +0200 |
commit | 6d94fc846d1a0ec2d4515f2715317778a5269223 (patch) | |
tree | 8e295f96ee9e05b5d9d13bfab1d8855b7708068f | |
parent | 2c8aa3751c6e0dab2439fee98cd173d579caed76 (diff) | |
parent | f61658945f5fd605a95c52d21e8f23c579fc96c6 (diff) | |
download | nextcloud-server-6d94fc846d1a0ec2d4515f2715317778a5269223.tar.gz nextcloud-server-6d94fc846d1a0ec2d4515f2715317778a5269223.zip |
Merge pull request #10394 from owncloud/close-filehandle-lib-image
Close file handle if exception occurs in image class
-rw-r--r-- | lib/private/image.php | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/private/image.php b/lib/private/image.php index 0dff8c5a9da..7ddc8dca143 100644 --- a/lib/private/image.php +++ b/lib/private/image.php @@ -603,6 +603,7 @@ class OC_Image { $meta = unpack('vtype/Vfilesize/Vreserved/Voffset', fread($fh, 14)); // check for bitmap if ($meta['type'] != 19778) { + fclose($fh); trigger_error('imagecreatefrombmp: ' . $fileName . ' is not a bitmap!', E_USER_WARNING); return false; } @@ -626,6 +627,7 @@ class OC_Image { if ($meta['imagesize'] < 1) { $meta['imagesize'] = @filesize($fileName) - $meta['offset']; if ($meta['imagesize'] < 1) { + fclose($fh); trigger_error('imagecreatefrombmp: Can not obtain filesize of ' . $fileName . '!', E_USER_WARNING); return false; } @@ -666,6 +668,7 @@ class OC_Image { break; case 16: if (!($part = substr($data, $p, 2))) { + fclose($fh); trigger_error($error, E_USER_WARNING); return $im; } @@ -712,6 +715,7 @@ class OC_Image { $color[1] = $palette[ $color[1] + 1 ]; break; default: + fclose($fh); trigger_error('imagecreatefrombmp: ' . $fileName . ' has ' . $meta['bits'] . ' bits and this is not supported!', E_USER_WARNING); |