Free more.

This commit is contained in:
Alessio Di Mauro
2015-09-09 13:16:45 +02:00
parent d793f200bb
commit d820c314c4
+8
View File
@@ -87,6 +87,8 @@ CK_DEFINE_FUNCTION(CK_RV, C_Finalize)(
) )
{ {
DIN; DIN;
CK_ULONG i;
if (pReserved != NULL_PTR) { if (pReserved != NULL_PTR) {
DBG(("Finalized called with pReserved != NULL")); DBG(("Finalized called with pReserved != NULL"));
return CKR_ARGUMENTS_BAD; return CKR_ARGUMENTS_BAD;
@@ -97,6 +99,9 @@ CK_DEFINE_FUNCTION(CK_RV, C_Finalize)(
return CKR_CRYPTOKI_NOT_INITIALIZED; return CKR_CRYPTOKI_NOT_INITIALIZED;
} }
for (i = 0; i < n_slots; i++) {
destroy_token(slots + i);
}
memset(slots, 0, sizeof(slots)); memset(slots, 0, sizeof(slots));
ykpiv_done(piv_state); // TODO: this calls disconnect... ykpiv_done(piv_state); // TODO: this calls disconnect...
@@ -547,6 +552,9 @@ CK_DEFINE_FUNCTION(CK_RV, C_OpenSession)(
} }
} }
free(cert_ids);
cert_ids = NULL;
session.handle = YKCS11_SESSION_ID; session.handle = YKCS11_SESSION_ID;
// TODO: KEEP TRACK OF THE APPLICATION (possble to steal a session?) // TODO: KEEP TRACK OF THE APPLICATION (possble to steal a session?)