diff options
Diffstat (limited to 'crypto/src/cms/CMSCompressedDataGenerator.cs')
-rw-r--r-- | crypto/src/cms/CMSCompressedDataGenerator.cs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crypto/src/cms/CMSCompressedDataGenerator.cs b/crypto/src/cms/CMSCompressedDataGenerator.cs index 70515e8d3..e60effa61 100644 --- a/crypto/src/cms/CMSCompressedDataGenerator.cs +++ b/crypto/src/cms/CMSCompressedDataGenerator.cs @@ -42,11 +42,11 @@ namespace Org.BouncyCastle.Cms try { MemoryStream bOut = new MemoryStream(); - Stream zOut = Utilities.IO.Compression.ZLib.CompressOutput(bOut, -1); - content.Write(zOut); - - Platform.Dispose(zOut); + using (var zOut = Utilities.IO.Compression.ZLib.CompressOutput(bOut, -1)) + { + content.Write(zOut); + } comAlgId = new AlgorithmIdentifier(CmsObjectIdentifiers.ZlibCompress); comOcts = new BerOctetString(bOut.ToArray()); |