File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
src/MySqlConnector/Utilities Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -138,12 +138,11 @@ public static RSAParameters GetRsaParameters(string key)
138
138
var keyChars = key . AsSpan ( ) [ keyStartIndex ..keyEndIndex ] ;
139
139
var bufferLength = keyChars . Length / 4 * 3 ;
140
140
byte [ ] ? buffer = null ;
141
- Span < byte > bufferBytes = bufferLength <= 1024 ? stackalloc byte [ bufferLength ] : default ;
141
+ scoped Span < byte > bufferBytes ;
142
142
if ( bufferLength > 1024 )
143
- {
144
- buffer = ArrayPool < byte > . Shared . Rent ( bufferLength ) ;
145
- bufferBytes = buffer . AsSpan ( ) ;
146
- }
143
+ bufferBytes = buffer = ArrayPool < byte > . Shared . Rent ( bufferLength ) ;
144
+ else
145
+ bufferBytes = stackalloc byte [ bufferLength ] ;
147
146
try
148
147
{
149
148
if ( ! System . Convert . TryFromBase64Chars ( keyChars , bufferBytes , out var bytesWritten ) )
You can’t perform that action at this time.
0 commit comments