Merge pull request #30182 from nextcloud/backport/30160/stable21

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

View file

@ -756,8 +756,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) {