pk11_CloseSession(context->slot,context->session,context->ownSession);
if (context->ownSession && context->key &&  context->key->session == context->session &&  !context->key->sessionOwner)               {  (void)PK11_Finalize(context);  context->key->sessionOwner = PR_TRUE; } else { pk11_CloseSession(context->slot,context->session,context->ownSession); }
PK11_DestroyContext(PK11Context *context, PRBool freeit){    pk11_CloseSession(context->slot,context->session,context->ownSession);    /* initialize the critical fields of the context */    if (context->savedData != NULL ) PORT_Free(context->savedData);    if (context->key) PK11_FreeSymKey(context->key);    if (context->param) SECITEM_FreeItem(context->param, PR_TRUE);    if (context->sessionLock) PZ_DestroyLock(context->sessionLock);    PK11_FreeSlot(context->slot);    if (freeit) PORT_Free(context);}