From 598c051eb056ed518c799975525fcc322615ae6e Mon Sep 17 00:00:00 2001 From: Ryosuke Miyazaki Date: Sat, 19 Oct 2019 23:40:57 +0900 Subject: [PATCH] Close encrypted file filestream --- EPPlus/Utils/CompundDocument/CompoundDocumentFile.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/EPPlus/Utils/CompundDocument/CompoundDocumentFile.cs b/EPPlus/Utils/CompundDocument/CompoundDocumentFile.cs index 16d8f228..3c594bee 100644 --- a/EPPlus/Utils/CompundDocument/CompoundDocumentFile.cs +++ b/EPPlus/Utils/CompundDocument/CompoundDocumentFile.cs @@ -114,10 +114,12 @@ public static bool IsCompoundDocument(FileInfo fi) { try { - var fs = fi.OpenRead(); - var b = new byte[8]; - fs.Read(b, 0, 8); - return IsCompoundDocument(b); + using (var fs = fi.OpenRead()) + { + var b = new byte[8]; + fs.Read(b, 0, 8); + return IsCompoundDocument(b); + } } catch {