diff options
author | Steve Pfister <steveisok@users.noreply.github.com> | 2019-11-19 16:23:51 +0300 |
---|---|---|
committer | Martin Baulig <mabaul@microsoft.com> | 2019-11-19 16:23:51 +0300 |
commit | 0c3ffb9cc9839a99b71e1c8dc2e85d462820a31c (patch) | |
tree | fb3ecfd817f0d95c2742ae3b2f7e57f65f33a6ce /mcs/class/System | |
parent | b8fe43da3ed89337c51dfa8f4e07955ed204761d (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.
Diffstat (limited to 'mcs/class/System')
-rw-r--r-- | mcs/class/System/Mono.Net.Security/MonoTlsStream.cs | 10 |
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; |