1 files changed, 29 insertions, 25 deletions
diff --git a/crypto/src/util/zlib/ZOutputStream.cs b/crypto/src/util/zlib/ZOutputStream.cs
index 1d2ead7b3..2cef06397 100644
--- a/crypto/src/util/zlib/ZOutputStream.cs
+++ b/crypto/src/util/zlib/ZOutputStream.cs
@@ -95,31 +95,35 @@ namespace Org.BouncyCastle.Utilities.Zlib
public sealed override bool CanSeek { get { return false; } }
public sealed override bool CanWrite { get { return !closed; } }
- public override void Close()
- {
- if (this.closed)
- return;
-
- try
- {
- try
- {
- Finish();
- }
- catch (IOException)
- {
- // Ignore
- }
- }
- finally
- {
- this.closed = true;
- End();
- output.Close();
- output = null;
- }
- }
-
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ if (this.closed)
+ return;
+
+ try
+ {
+ try
+ {
+ Finish();
+ }
+ catch (IOException)
+ {
+ // Ignore
+ }
+ }
+ finally
+ {
+ this.closed = true;
+ End();
+ output.Dispose();
+ output = null;
+ }
+ }
+ base.Dispose(disposing);
+ }
+
public virtual void End()
{
if (z == null)
|