diff options
-rw-r--r-- | src/WixToolset.Core.WindowsInstaller/MsiBackend.cs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs b/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs index 778720b9..cbd58381 100644 --- a/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs +++ b/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs | |||
@@ -26,6 +26,7 @@ namespace WixToolset.Core.WindowsInstaller | |||
26 | var validator = Validator.CreateFromContext(context, "darice.cub"); | 26 | var validator = Validator.CreateFromContext(context, "darice.cub"); |
27 | 27 | ||
28 | IBindResult result = null; | 28 | IBindResult result = null; |
29 | var dispose = true; | ||
29 | try | 30 | try |
30 | { | 31 | { |
31 | var command = new BindDatabaseCommand(context, backendExtensions, validator); | 32 | var command = new BindDatabaseCommand(context, backendExtensions, validator); |
@@ -36,12 +37,15 @@ namespace WixToolset.Core.WindowsInstaller | |||
36 | extension.PostBackendBind(result); | 37 | extension.PostBackendBind(result); |
37 | } | 38 | } |
38 | 39 | ||
40 | dispose = false; | ||
39 | return result; | 41 | return result; |
40 | } | 42 | } |
41 | catch | 43 | finally |
42 | { | 44 | { |
43 | result?.Dispose(); | 45 | if (dispose) |
44 | throw; | 46 | { |
47 | result?.Dispose(); | ||
48 | } | ||
45 | } | 49 | } |
46 | } | 50 | } |
47 | 51 | ||