summary refs log tree commit diff
path: root/crypto/src/bcpg/ContainedPacket.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-04-20 18:42:12 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-04-20 18:42:12 +0700
commit8ab0160708d540e42b086582bd1992f5269f7166 (patch)
tree528bf8667e4db801fe74f888ad51d08f7533ba27 /crypto/src/bcpg/ContainedPacket.cs
parentRefactoring: reduced allocations (diff)
downloadBouncyCastle.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.cs10
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);