OpenSC/libp11 — pull request #7 by commonism (2013-10-06 09:53:13+00:00)
Title: Fix memoryleaks when loading keys/certs

This pull request requires another pull on engine_pkcs11.
The changes relocate the code to load keys and certs into p11.
They make use of OpenSSL ex_data to free the PKCS11_* resources allocated when loading a key.
The reduction is 0bytes leaked per loaded key instead of (at least) 7kbyte.

Adding the ability to unload the p11 error strings is a minor change included as well.

The changes may look involved, as the code was written for engine_pkcs11 previously and got moved.
I have a rebased version of the changes as well, but I prefer having the complete history of changes.
If you disagree, let me know and I'll send a pull request for the rebased branch.