From 7c10d0a874d7e447d0fce6906316919ffff5434d Mon Sep 17 00:00:00 2001 From: morkt Date: Tue, 8 Mar 2016 17:13:22 +0400 Subject: [PATCH] (Xp3Opener): dispose of archive in case of encryption plugin initialization error. --- ArcFormats/KiriKiri/ArcXP3.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ArcFormats/KiriKiri/ArcXP3.cs b/ArcFormats/KiriKiri/ArcXP3.cs index 0783ceb2..aa2f64af 100644 --- a/ArcFormats/KiriKiri/ArcXP3.cs +++ b/ArcFormats/KiriKiri/ArcXP3.cs @@ -260,9 +260,17 @@ NextEntry: } } var arc = new ArcFile (file, this, dir); - if (crypt_algorithm.IsValueCreated) - crypt_algorithm.Value.Init (arc); - return arc; + try + { + if (crypt_algorithm.IsValueCreated) + crypt_algorithm.Value.Init (arc); + return arc; + } + catch + { + arc.Dispose(); + throw; + } } static readonly Regex ObfuscatedPathRe = new Regex (@"[^\\/]+[\\/]\.\.[\\/]");