fix: memory leak (but see FIXME)
==21111== 1,360 (120 direct, 1,240 indirect) bytes in 1 blocks are definitely lost in loss record 107 of 109 ==21111== at 0x4C24F0D: realloc (vg_replace_malloc.c:476) ==21111== by 0x409D23: sc_pkcs11_register_mechanism (mechanism.c:44) ==21111== by 0x410595: pkcs15_bind (framework-pkcs15.c:3160) ==21111== by 0x4085DD: card_detect (slot.c:214) ==21111== by 0x408887: initialize_reader (slot.c:114) ==21111== by 0x404C50: C_Initialize (pkcs11-global.c:247) ==21111== by 0x4034C9: main ==21111== ==21111== LEAK SUMMARY: ==21111== definitely lost: 120 bytes in 1 blocks git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4388 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
a91e77187b
commit
0f74f69695
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user