[NSS] Simplify error handling in get_token_objects_for_cache.

This commit is contained in:
Moonchild 2025-02-04 18:09:28 +01:00 committed by roytam1
commit ecb18ddf57

View file

@ -584,8 +584,11 @@ get_token_objects_for_cache(
} else {
PRUint32 j;
for (j = 0; j < i; j++) {
/* sigh */
nssToken_AddRef(cache->objects[objectType][j]->object->token);
/* Objects that were successfully added to the cache do not own a
* token reference (they share a reference with the cache itself).
* Nulling out the pointer here prevents the token's refcount
* from being decremented in nssCryptokiObject_Destroy */
cache->objects[objectType][j]->object->token = NULL;
nssArena_Destroy(cache->objects[objectType][j]->arena);
}
nss_ZFreeIf(cache->objects[objectType]);