summary refs log tree commit diff
path: root/crypto/test/src/openpgp/test/PGPRSATest.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/test/src/openpgp/test/PGPRSATest.cs')
-rw-r--r--crypto/test/src/openpgp/test/PGPRSATest.cs11
1 files changed, 5 insertions, 6 deletions
diff --git a/crypto/test/src/openpgp/test/PGPRSATest.cs b/crypto/test/src/openpgp/test/PGPRSATest.cs
index e3ed2f021..d8b350b2d 100644
--- a/crypto/test/src/openpgp/test/PGPRSATest.cs
+++ b/crypto/test/src/openpgp/test/PGPRSATest.cs
@@ -354,16 +354,15 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
             //
             MemoryStream bOut = new MemoryStream();
             PgpLiteralDataGenerator lGen = new PgpLiteralDataGenerator();
-            Stream lOut = lGen.Open(
+            using (var lOut = lGen.Open(
                 bOut,
                 PgpLiteralData.Binary,
                 PgpLiteralData.Console,
                 text.Length,
-                DateTime.UtcNow);
-
-            lOut.Write(text, 0, text.Length);
-
-            lGen.Dispose();
+                DateTime.UtcNow))
+            {
+                lOut.Write(text, 0, text.Length);
+            }
 
             byte[] bytes = bOut.ToArray();