mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[FileTools] Manual dispose of file stream (thanks edc!)
This commit is contained in:
@@ -492,10 +492,11 @@ namespace SabreTools.Helper
|
||||
return encounteredErrors;
|
||||
}
|
||||
|
||||
FileStream fs = null;
|
||||
try
|
||||
{
|
||||
using (FileStream fs = File.OpenRead(input))
|
||||
{
|
||||
fs = File.OpenRead(input);
|
||||
|
||||
if (at == ArchiveType.SevenZip && sevenzip != ArchiveScanLevel.External)
|
||||
{
|
||||
using (SevenZipArchive sza = SevenZipArchive.Open(fs))
|
||||
@@ -553,7 +554,6 @@ namespace SabreTools.Helper
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (EndOfStreamException)
|
||||
{
|
||||
// Catch this but don't count it as an error because SharpCompress is unsafe
|
||||
@@ -567,6 +567,11 @@ namespace SabreTools.Helper
|
||||
// Don't log file open errors
|
||||
encounteredErrors = true;
|
||||
}
|
||||
finally
|
||||
{
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
}
|
||||
|
||||
return encounteredErrors;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user