Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dispose SslStream in ShutdownSocket #275

Closed
bgrainger opened this issue Jun 20, 2017 · 3 comments
Closed

Dispose SslStream in ShutdownSocket #275

bgrainger opened this issue Jun 20, 2017 · 3 comments
Labels

Comments

@bgrainger
Copy link
Member

bgrainger commented Jun 20, 2017

It doesn't appear that the SslStream allocated in MySqlSession.InitSslAsync is ever disposed. This might result in native memory leaks.

We probably need to dispose the X509Certificate2 allocated in that method, too.

@bgrainger bgrainger added the bug label Jun 20, 2017
@bgrainger
Copy link
Member Author

bgrainger commented Jun 20, 2017

RE: X509Certificate

Starting with the .NET Framework 4.6, this type implements the IDisposable interface. ... For apps that target the .NET Framework 4.5.2 and earlier versions, the X509Certificate class does not implement the IDisposable interface and therefore does not have a Dispose method.

Could start disposing it in builds that support net46 and/or netstandard2.0.

bgrainger added a commit that referenced this issue Jun 20, 2017
bgrainger added a commit that referenced this issue Jun 20, 2017
This commit doesn't ensure that an ObjectDisposedException will be thrown
if an object is used after it's disposed; a NullReferenceException or
some other exception may be thrown instead. These are internal types
that should always be used correctly in this code, so tracking incorrect
use of Dispose is a low priority.
@bgrainger
Copy link
Member Author

bgrainger commented Jun 21, 2017

Fixed in 0.20.2.

bgrainger added a commit that referenced this issue Jun 29, 2017
On .NET 4.6 and .NET Standard 1.0 (and later), X509Certificate
implements IDisposable and should be disposed to free resources.
@bgrainger
Copy link
Member Author

bgrainger commented Jul 10, 2017

Fixed X509Certificate2 in 0.23.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant