diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-11-09 01:13:27 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-11-09 01:13:27 +0700 |
commit | a8a17fd70fc8df3ca7402323ad5c4f36b25cb806 (patch) | |
tree | 9b276b62885505abbb899d17744b65b912072140 /crypto/src/cms/CMSSignedDataStreamGenerator.cs | |
parent | Primes improvements (diff) | |
download | BouncyCastle.NET-ed25519-a8a17fd70fc8df3ca7402323ad5c4f36b25cb806.tar.xz |
Dispose cleanup
- IDisposable for PemReader, PemWriter, IStreamGenerator
Diffstat (limited to 'crypto/src/cms/CMSSignedDataStreamGenerator.cs')
-rw-r--r-- | crypto/src/cms/CMSSignedDataStreamGenerator.cs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/crypto/src/cms/CMSSignedDataStreamGenerator.cs b/crypto/src/cms/CMSSignedDataStreamGenerator.cs index 3f2da5f7e..a4e960ba6 100644 --- a/crypto/src/cms/CMSSignedDataStreamGenerator.cs +++ b/crypto/src/cms/CMSSignedDataStreamGenerator.cs @@ -621,12 +621,13 @@ namespace Org.BouncyCastle.Cms Stream dataOutputStream, CmsProcessable content) { - Stream signedOut = Open(outStream, eContentType, encapsulate, dataOutputStream); - if (content != null) + using (var signedOut = Open(outStream, eContentType, encapsulate, dataOutputStream)) { - content.Write(signedOut); - } - Platform.Dispose(signedOut); + if (content != null) + { + content.Write(signedOut); + } + } } // RFC3852, section 5.1: @@ -806,7 +807,7 @@ namespace Org.BouncyCastle.Cms private void DoClose() { - Platform.Dispose(_out); + _out.Dispose(); // TODO Parent context(s) should really be be closed explicitly |