diff --git a/lib/filestorage/file_storage.php b/lib/filestorage/file_storage.php index 7b5f5b99439..c8020e9411b 100644 --- a/lib/filestorage/file_storage.php +++ b/lib/filestorage/file_storage.php @@ -1987,6 +1987,7 @@ class file_storage { @unlink($hashfile.'.tmp'); if (!copy($pathname, $hashfile.'.tmp')) { // Borked permissions or out of disk space. + @unlink($hashfile.'.tmp'); ignore_user_abort($prev); throw new file_exception('storedfilecannotcreatefile'); }