properly dispose of cryptography-related classes.

This commit is contained in:
morkt
2016-02-18 02:36:03 +04:00
parent 747f917b44
commit 3e313995d7
2 changed files with 9 additions and 7 deletions

View File

@@ -125,11 +125,12 @@ namespace GameRes.Formats.Purple
if (index.Length != index_size)
return null;
var md5 = MD5.Create();
var hash = md5.ComputeHash (index);
if (!header.Skip (0x10).Take (0x10).SequenceEqual (hash))
return null;
using (var md5 = MD5.Create())
{
var hash = md5.ComputeHash (index);
if (!header.Skip (0x10).Take (0x10).SequenceEqual (hash))
return null;
}
foreach (var scheme in KnownSchemes.Values)
{
// both CmvsMd5 and index will be altered by ReadIndex in decryption attempt