p11-glue / p11-kit

Provides a way to load and enumerate PKCS#11 modules.
https://p11-glue.github.io/p11-glue/p11-kit.html
Other
151 stars 94 forks source link

Make use of `cleanup` attribute in `p11-kit` commands #577

Open ueno opened 1 year ago

ueno commented 1 year ago

Modern C compilers support the cleanup attribute for automatically release resources (memory, open file descriptor, etc.) at function exit. We could use it in the p11-kit commands instead of manual cleanup, as in systemd or GLib.

It might be worth noting that we probably shouldn't use this technique in the library as it intends to be portable.