Merge pull request #30180 from nextcloud/backport/30160/stable23

[stable23] Check resource before closing in encryption wrapper
This commit is contained in:
Vincent Petry 2021-12-10 08:55:50 +01:00 committed by GitHub
commit 1fc27e771c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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) {