From: Stephen Toub Date: Sun, 27 Sep 2020 12:35:24 +0000 (-0400) Subject: Remove unnecessary byte[] allocation from CertificateRequest.CreateSelfSigned (#42776) X-Git-Tag: submit/tizen/20210909.063632~5306 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0743354ff5fe9c4fe206e6ead05c58a905d9e049;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Remove unnecessary byte[] allocation from CertificateRequest.CreateSelfSigned (#42776) --- diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs index 9f4bf54..d1c6fc4 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs @@ -308,7 +308,7 @@ namespace System.Security.Cryptography.X509Certificates Debug.Assert(_generator != null); - byte[] serialNumber = new byte[8]; + Span serialNumber = stackalloc byte[8]; RandomNumberGenerator.Fill(serialNumber); using (X509Certificate2 certificate = Create(