mirror of
https://github.com/nextcloud/server.git
synced 2026-02-20 00:12:30 -05:00
Check resource before closing in encryption wrapper
In case of error there is no guarantee that $source or $target is set or is a resource when handling an error. Without this fix, there's a risk that fclose will fail and the actual exception will not be thrown, making it impossible to find out about the root cause. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
This commit is contained in:
parent
28992a403e
commit
1291abc130
1 changed files with 6 additions and 2 deletions
|
|
@ -784,8 +784,12 @@ class Encryption extends Wrapper {
|
|||
fclose($source);
|
||||
fclose($target);
|
||||
} catch (\Exception $e) {
|
||||
fclose($source);
|
||||
fclose($target);
|
||||
if (is_resource($source)) {
|
||||
fclose($source);
|
||||
}
|
||||
if (is_resource($target)) {
|
||||
fclose($target);
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
if ($result) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue