From 975eb60e90eb346a38993c01f139e098a3c7a655 Mon Sep 17 00:00:00 2001 From: Christian Kratky Date: Tue, 30 Jul 2019 20:02:46 +0200 Subject: [PATCH] Fix memory leak when SSL is not working properly. --- Source/MQTTnet/Implementations/MqttTcpChannel.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/MQTTnet/Implementations/MqttTcpChannel.cs b/Source/MQTTnet/Implementations/MqttTcpChannel.cs index 63adf55..12fd2bb 100644 --- a/Source/MQTTnet/Implementations/MqttTcpChannel.cs +++ b/Source/MQTTnet/Implementations/MqttTcpChannel.cs @@ -84,9 +84,9 @@ namespace MQTTnet.Implementations if (_options.TlsOptions.UseTls) { var sslStream = new SslStream(networkStream, false, InternalUserCertificateValidationCallback); - await sslStream.AuthenticateAsClientAsync(_options.Server, LoadCertificates(), _options.TlsOptions.SslProtocol, _options.TlsOptions.IgnoreCertificateRevocationErrors).ConfigureAwait(false); - _stream = sslStream; + + await sslStream.AuthenticateAsClientAsync(_options.Server, LoadCertificates(), _options.TlsOptions.SslProtocol, _options.TlsOptions.IgnoreCertificateRevocationErrors).ConfigureAwait(false); } else {