Fixed memory leaks
This commit is contained in:
parent
2bb0cb2615
commit
5129c5a060
|
@ -1391,6 +1391,7 @@ static CK_RV
|
|||
pkcs15_release_token(struct sc_pkcs11_card *p11card, void *fw_token)
|
||||
{
|
||||
sc_log(context, "pkcs15_release_token() not implemented");
|
||||
free(fw_token);
|
||||
return CKR_FUNCTION_REJECTED;
|
||||
}
|
||||
|
||||
|
|
|
@ -635,7 +635,7 @@ CK_RV C_InitToken(CK_SLOT_ID slotID,
|
|||
}
|
||||
}
|
||||
|
||||
rv = slot->p11card->framework->init_token(slot,slot->fw_data, pPin, ulPinLen, pLabel);
|
||||
rv = slot->p11card->framework->init_token(slot, slot->fw_data, pPin, ulPinLen, pLabel);
|
||||
if (rv == CKR_OK) {
|
||||
/* Now we should re-bind all tokens so they get the
|
||||
* corresponding function vector and flags */
|
||||
|
|
|
@ -107,6 +107,7 @@ void delete_slot(struct sc_pkcs11_slot *slot)
|
|||
{
|
||||
if (slot) {
|
||||
list_destroy(&slot->objects);
|
||||
list_destroy(&slot->logins);
|
||||
list_delete(&virtual_slots, slot);
|
||||
free(slot);
|
||||
}
|
||||
|
@ -437,8 +438,10 @@ CK_RV slot_token_removed(CK_SLOT_ID id)
|
|||
/* Release framework stuff */
|
||||
if (slot->p11card != NULL) {
|
||||
if (slot->fw_data != NULL &&
|
||||
slot->p11card->framework != NULL && slot->p11card->framework->release_token != NULL)
|
||||
slot->p11card->framework != NULL && slot->p11card->framework->release_token != NULL) {
|
||||
slot->p11card->framework->release_token(slot->p11card, slot->fw_data);
|
||||
slot->fw_data = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Reset relevant slot properties */
|
||||
|
|
|
@ -974,6 +974,7 @@ static void list_slots(int tokens, int refresh, int print)
|
|||
rv = p11->C_GetSlotList(tokens, NULL, &p11_num_slots);
|
||||
if (rv != CKR_OK)
|
||||
p11_fatal("C_GetSlotList(NULL)", rv);
|
||||
free(p11_slots);
|
||||
p11_slots = calloc(p11_num_slots, sizeof(CK_SLOT_ID));
|
||||
if (p11_slots == NULL) {
|
||||
perror("calloc failed");
|
||||
|
|
Loading…
Reference in New Issue