diff --git a/src/pkcs11/slot.c b/src/pkcs11/slot.c index 1ba74d73..e50cbeea 100644 --- a/src/pkcs11/slot.c +++ b/src/pkcs11/slot.c @@ -139,6 +139,19 @@ CK_RV card_removed(sc_reader_t * reader) if (card) { card->framework->unbind(card); sc_disconnect_card(card->card); + /* FIXME: free mechanisms + * spaces allocated by the + * sc_pkcs11_register_sign_and_hash_mechanism + * and sc_pkcs11_new_fw_mechanism. + * but see sc_pkcs11_register_generic_mechanisms + for (i=0; i < card->nmechanisms; ++i) { + // if 'mech_data' is a pointer earlier returned by the ?alloc + free(card->mechanisms[i]->mech_data); + // if 'mechanisms[i]' is a pointer earlier returned by the ?alloc + free(card->mechanisms[i]); + } + */ + free(card->mechanisms); free(card); }