wolfSSL / wolfTPM

wolfTPM is a highly portable TPM 2.0 library, designed for embedded use.
https://www.wolfssl.com
GNU General Public License v2.0
244 stars 60 forks source link

wolftpm C# wrapper needs to implement IDisposable instead of using Finalizer. #221

Closed ghost closed 2 years ago

ghost commented 2 years ago

In the wolfTPM.cs, when cleaning up resources, the C# Finalizer are used instead of following the IDisposable. This can be dangerous as the resources are only cleaned up when the finalizers are run by the GC (hopefully). In many cases, the finalizer may never run as such resource leak will ensure.

The following classes should implement IDisposable:

dgarske commented 2 years ago

Hi @zhichao-h , great suggestion! I will get a PR put up tomorrow fixing the way the classes are finalized.

dgarske commented 2 years ago

Fixed in #225. Marking closed.