diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-04-20 18:42:12 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-04-20 18:42:12 +0700 |
commit | 8ab0160708d540e42b086582bd1992f5269f7166 (patch) | |
tree | 528bf8667e4db801fe74f888ad51d08f7533ba27 /crypto/src/bcpg/ContainedPacket.cs | |
parent | Refactoring: reduced allocations (diff) | |
download | BouncyCastle.NET-ed25519-8ab0160708d540e42b086582bd1992f5269f7166.tar.xz |
Fix missing Dispose(s) of BcpgOutputStream
Diffstat (limited to 'crypto/src/bcpg/ContainedPacket.cs')
-rw-r--r-- | crypto/src/bcpg/ContainedPacket.cs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crypto/src/bcpg/ContainedPacket.cs b/crypto/src/bcpg/ContainedPacket.cs index e8f387ca4..ca39fd985 100644 --- a/crypto/src/bcpg/ContainedPacket.cs +++ b/crypto/src/bcpg/ContainedPacket.cs @@ -10,11 +10,11 @@ namespace Org.BouncyCastle.Bcpg public byte[] GetEncoded() { MemoryStream bOut = new MemoryStream(); - BcpgOutputStream pOut = new BcpgOutputStream(bOut); - - pOut.WritePacket(this); - - return bOut.ToArray(); + using (var pOut = new BcpgOutputStream(bOut)) + { + pOut.WritePacket(this); + } + return bOut.ToArray(); } public abstract void Encode(BcpgOutputStream bcpgOut); |