[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 { } else {
PRUint32 j; PRUint32 j;
for (j = 0; j < i; j++) { for (j = 0; j < i; j++) {
/* sigh */ /* Objects that were successfully added to the cache do not own a
nssToken_AddRef(cache->objects[objectType][j]->object->token); * 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); nssArena_Destroy(cache->objects[objectType][j]->arena);
} }
nss_ZFreeIf(cache->objects[objectType]); nss_ZFreeIf(cache->objects[objectType]);