diff options
Diffstat (limited to 'crypto/src/pkix/PkixCertPath.cs')
-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) { |