Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Pfister <steveisok@users.noreply.github.com>2019-11-19 16:23:51 +0300
committerMartin Baulig <mabaul@microsoft.com>2019-11-19 16:23:51 +0300
commit0c3ffb9cc9839a99b71e1c8dc2e85d462820a31c (patch)
treefb3ecfd817f0d95c2742ae3b2f7e57f65f33a6ce
parentb8fe43da3ed89337c51dfa8f4e07955ed204761d (diff)
Fixes https://github.com/mono/mono/issues/15805 at least in terms of what may be making it crash. (#17270)
Adds a null check around the sslStream before trying to dispose.
-rw-r--r--mcs/class/System/Mono.Net.Security/MonoTlsStream.cs10
1 files changed, 6 insertions, 4 deletions
diff --git a/mcs/class/System/Mono.Net.Security/MonoTlsStream.cs b/mcs/class/System/Mono.Net.Security/MonoTlsStream.cs
index 4573b9c380f..935df6acaf0 100644
--- a/mcs/class/System/Mono.Net.Security/MonoTlsStream.cs
+++ b/mcs/class/System/Mono.Net.Security/MonoTlsStream.cs
@@ -132,8 +132,7 @@ namespace Mono.Net.Security
status = WebExceptionStatus.SecureChannelFailure;
request.ServicePoint.UpdateClientCertificate (null);
- sslStream.Dispose ();
- sslStream = null;
+ CloseSslStream ();
throw;
}
@@ -142,8 +141,7 @@ namespace Mono.Net.Security
await sslStream.WriteAsync (tunnel.Data, 0, tunnel.Data.Length, cancellationToken).ConfigureAwait (false);
} catch {
status = WebExceptionStatus.SendFailure;
- sslStream.Dispose ();
- sslStream = null;
+ CloseSslStream ();
throw;
}
@@ -155,6 +153,10 @@ namespace Mono.Net.Security
public void Dispose ()
{
+ CloseSslStream ();
+ }
+
+ void CloseSslStream () {
if (sslStream != null) {
sslStream.Dispose ();
sslStream = null;