summary refs log tree commit diff
path: root/crypto/src/asn1
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-03-10 13:28:46 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-03-10 13:28:46 +0700
commit9995dc06402d6dbe33862c151eab6150c4de14e5 (patch)
treec3c1ab51a7cdd8bbbda6d14411900ddea4666fab /crypto/src/asn1
parentRemove unnecessary methods (diff)
downloadBouncyCastle.NET-ed25519-9995dc06402d6dbe33862c151eab6150c4de14e5.tar.xz
Refactor IDisposable implementations
Diffstat (limited to 'crypto/src/asn1')
-rw-r--r--crypto/src/asn1/ASN1Generator.cs2
-rw-r--r--crypto/src/asn1/Asn1InputStream.cs5
-rw-r--r--crypto/src/asn1/x509/TBSCertList.cs10
3 files changed, 8 insertions, 9 deletions
diff --git a/crypto/src/asn1/ASN1Generator.cs b/crypto/src/asn1/ASN1Generator.cs
index 28fffc6ab..1e8351149 100644
--- a/crypto/src/asn1/ASN1Generator.cs
+++ b/crypto/src/asn1/ASN1Generator.cs
@@ -30,7 +30,7 @@ namespace Org.BouncyCastle.Asn1
 
         public void Dispose()
         {
-            Dispose(true);
+            Dispose(disposing: true);
             GC.SuppressFinalize(this);
         }
 
diff --git a/crypto/src/asn1/Asn1InputStream.cs b/crypto/src/asn1/Asn1InputStream.cs
index bd93d4758..b4a87eae1 100644
--- a/crypto/src/asn1/Asn1InputStream.cs
+++ b/crypto/src/asn1/Asn1InputStream.cs
@@ -82,10 +82,7 @@ namespace Org.BouncyCastle.Asn1
 
         protected override void Dispose(bool disposing)
         {
-            if (disposing)
-            {
-                tmpBuffers = null;
-            }
+            tmpBuffers = null;
 
             if (m_leaveOpen)
             {
diff --git a/crypto/src/asn1/x509/TBSCertList.cs b/crypto/src/asn1/x509/TBSCertList.cs
index 2b288850f..009773e79 100644
--- a/crypto/src/asn1/x509/TBSCertList.cs
+++ b/crypto/src/asn1/x509/TBSCertList.cs
@@ -97,7 +97,7 @@ namespace Org.BouncyCastle.Asn1.X509
 				return new RevokedCertificatesEnumerator(en.GetEnumerator());
 			}
 
-			private class RevokedCertificatesEnumerator
+			private sealed class RevokedCertificatesEnumerator
 				: IEnumerator<CrlEntry>
 			{
 				private readonly IEnumerator<Asn1Encodable> e;
@@ -107,11 +107,13 @@ namespace Org.BouncyCastle.Asn1.X509
 					this.e = e;
 				}
 
-				public virtual void Dispose()
+				public void Dispose()
 				{
-				}
+					e.Dispose();
+                    GC.SuppressFinalize(this);
+                }
 
-				public bool MoveNext()
+                public bool MoveNext()
 				{
 					return e.MoveNext();
 				}