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

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

Closed
ghost opened this issue Jul 6, 2022 · 2 comments
Closed
Assignees

Comments

@ghost
Copy link

ghost commented Jul 6, 2022

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:

  • KeyBlob
  • Key
  • Template
  • Session
  • Device.
@dgarske dgarske self-assigned this Jul 6, 2022
@dgarske
Copy link
Contributor

dgarske commented Jul 6, 2022

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

dgarske added a commit to dgarske/wolfTPM that referenced this issue Jul 12, 2022
dgarske added a commit to dgarske/wolfTPM that referenced this issue Jul 12, 2022
dgarske added a commit to dgarske/wolfTPM that referenced this issue Jul 12, 2022
dgarske added a commit to dgarske/wolfTPM that referenced this issue Jul 13, 2022
@dgarske
Copy link
Contributor

dgarske commented Jul 15, 2022

Fixed in #225. Marking closed.

@dgarske dgarske closed this as completed Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant