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/pkix | |
parent | Primes improvements (diff) | |
download | BouncyCastle.NET-ed25519-a8a17fd70fc8df3ca7402323ad5c4f36b25cb806.tar.xz |
Dispose cleanup
- IDisposable for PemReader, PemWriter, IStreamGenerator
Diffstat (limited to 'crypto/src/pkix')
-rw-r--r-- | crypto/src/pkix/PkixCertPath.cs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crypto/src/pkix/PkixCertPath.cs b/crypto/src/pkix/PkixCertPath.cs index 95280173a..7f04b1b63 100644 --- a/crypto/src/pkix/PkixCertPath.cs +++ b/crypto/src/pkix/PkixCertPath.cs @@ -352,16 +352,16 @@ namespace Org.BouncyCastle.Pkix else if (Platform.EqualsIgnoreCase(encoding, "PEM")) { MemoryStream bOut = new MemoryStream(); - PemWriter pWrt = new PemWriter(new StreamWriter(bOut)); try { - foreach (var cert in m_certificates) + using (var pWrt = new PemWriter(new StreamWriter(bOut))) { - pWrt.WriteObject(cert); - } - - Platform.Dispose(pWrt.Writer); + foreach (var cert in m_certificates) + { + pWrt.WriteObject(cert); + } + } } catch (Exception) { |