let ArrayPool clear returned arrays
authorWraith2 <wraith2@gmail.com>
Thu, 14 Mar 2019 01:03:54 +0000 (01:03 +0000)
committerWraith2 <wraith2@gmail.com>
Thu, 14 Mar 2019 01:03:54 +0000 (01:03 +0000)
Commit migrated from https://github.com/dotnet/corefx/commit/0972e60bb1d8fb1ba867e29f7ea7d7a81506af51

src/libraries/System.Data.SqlClient/src/System/Data/SqlClient/TdsParser.cs

index f82dfd4..d6f477a 100644 (file)
@@ -9281,8 +9281,7 @@ namespace System.Data.SqlClient
                 }
             }
 
-            Array.Clear(inBuff, 0, constTextBufferSize);
-            ArrayPool<char>.Shared.Return(inBuff, clearArray: false);
+            ArrayPool<char>.Shared.Return(inBuff, clearArray: true);
         }
 
         private async Task WriteStreamFeed(StreamDataFeed feed, TdsParserStateObject stateObj, int len)
@@ -9330,8 +9329,7 @@ namespace System.Data.SqlClient
                 } while (len <= 0 || nWritten < len);
             }
 
-            Array.Clear(buff, 0, constTextBufferSize);
-            ArrayPool<byte>.Shared.Return(buff, clearArray: false);
+            ArrayPool<byte>.Shared.Return(buff, clearArray: true);
         }
 
         private Task NullIfCompletedWriteTask(Task task)