summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Files/Storage/Common.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php
index 8760fae1185..82ac49b9fdf 100644
--- a/lib/private/Files/Storage/Common.php
+++ b/lib/private/Files/Storage/Common.php
@@ -857,9 +857,12 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage {
if (!$target) {
return 0;
}
- list($count, $result) = \OC_Helper::streamCopy($stream, $target);
- fclose($stream);
- fclose($target);
+ try {
+ [$count, $result] = \OC_Helper::streamCopy($stream, $target);
+ } finally {
+ fclose($target);
+ fclose($stream);
+ }
return $count;
}
}