diff options
Diffstat (limited to 'security/nss/lib/ckfw/object.c')
-rw-r--r-- | security/nss/lib/ckfw/object.c | 38 |
1 files changed, 3 insertions, 35 deletions
diff --git a/security/nss/lib/ckfw/object.c b/security/nss/lib/ckfw/object.c index d076f06a79..9f6b4cee03 100644 --- a/security/nss/lib/ckfw/object.c +++ b/security/nss/lib/ckfw/object.c @@ -52,7 +52,6 @@ struct NSSCKFWObjectStr { NSSCKFWMutex *mutex; /* merely to serialise the MDObject calls */ NSSArena *arena; - NSSArena *localArena; NSSCKMDObject *mdObject; NSSCKMDSession *mdSession; NSSCKFWSession *fwSession; @@ -111,8 +110,6 @@ nssCKFWObject_Create( NSSCKFWInstance *fwInstance, CK_RV *pError) { - NSSArena *objArena = arena; - NSSArena *localArena = NULL; NSSCKFWObject *fwObject; nssCKFWHash *mdObjectHash; @@ -142,23 +139,13 @@ nssCKFWObject_Create( return fwObject; } - /* session objects should have their own arena so they can be destroyed in the end. */ - if (arena == NULL) { - localArena = objArena = NSSArena_Create(); - if (objArena == NULL) { - *pError = CKR_HOST_MEMORY; - return (NSSCKFWObject *)NULL; - } - } - - fwObject = nss_ZNEW(objArena, NSSCKFWObject); + fwObject = nss_ZNEW(arena, NSSCKFWObject); if (!fwObject) { *pError = CKR_HOST_MEMORY; return (NSSCKFWObject *)NULL; } - fwObject->arena = objArena; - fwObject->localArena = localArena; + fwObject->arena = arena; fwObject->mdObject = mdObject; fwObject->fwSession = fwSession; @@ -170,24 +157,18 @@ nssCKFWObject_Create( fwObject->mdToken = nssCKFWToken_GetMDToken(fwToken); fwObject->fwInstance = fwInstance; fwObject->mdInstance = nssCKFWInstance_GetMDInstance(fwInstance); - fwObject->mutex = nssCKFWInstance_CreateMutex(fwInstance, objArena, pError); + fwObject->mutex = nssCKFWInstance_CreateMutex(fwInstance, arena, pError); if (!fwObject->mutex) { if (CKR_OK == *pError) { *pError = CKR_GENERAL_ERROR; } nss_ZFreeIf(fwObject); - if (localArena) { - NSSArena_Destroy(localArena); - } return (NSSCKFWObject *)NULL; } *pError = nssCKFWHash_Add(mdObjectHash, mdObject, fwObject); if (CKR_OK != *pError) { nss_ZFreeIf(fwObject); - if (localArena) { - NSSArena_Destroy(localArena); - } return (NSSCKFWObject *)NULL; } @@ -196,9 +177,6 @@ nssCKFWObject_Create( if (CKR_OK != *pError) { nssCKFWHash_Remove(mdObjectHash, mdObject); nss_ZFreeIf(fwObject); - if (localArena) { - NSSArena_Destroy(localArena); - } return (NSSCKFWObject *)NULL; } #endif /* DEBUG */ @@ -217,7 +195,6 @@ nssCKFWObject_Finalize( PRBool removeFromHash) { nssCKFWHash *mdObjectHash; - NSSArena *arena = NULL; #ifdef NSSDEBUG if (CKR_OK != nssCKFWObject_verifyPointer(fwObject)) { @@ -243,11 +220,7 @@ nssCKFWObject_Finalize( if (fwObject->fwSession) { nssCKFWSession_DeregisterSessionObject(fwObject->fwSession, fwObject); } - arena = fwObject->localArena; nss_ZFreeIf(fwObject); - if (arena) { - NSSArena_Destroy(arena); - } #ifdef DEBUG (void)object_remove_pointer(fwObject); @@ -265,7 +238,6 @@ nssCKFWObject_Destroy( NSSCKFWObject *fwObject) { nssCKFWHash *mdObjectHash; - NSSArena *arena = NULL; #ifdef NSSDEBUG if (CKR_OK != nssCKFWObject_verifyPointer(fwObject)) { @@ -289,11 +261,7 @@ nssCKFWObject_Destroy( if (fwObject->fwSession) { nssCKFWSession_DeregisterSessionObject(fwObject->fwSession, fwObject); } - arena = fwObject->localArena; nss_ZFreeIf(fwObject); - if (arena) { - NSSArena_Destroy(arena); - } #ifdef DEBUG (void)object_remove_pointer(fwObject); |