summaryrefslogtreecommitdiff
path: root/security/nss/lib/util/secoid.c
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-29 09:07:42 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-29 09:07:42 +0200
commita78976f0ab7113160343b64a0517ed3c5880eacc (patch)
treeaa2909ae4718f81c83c8cfb68c1f5a23485b3173 /security/nss/lib/util/secoid.c
parent733f8f1eb908a84d41b46bec94604460dba87479 (diff)
parent80a1c2cdd31c909c65a71980c89dea2e474251c1 (diff)
downloaduxp-a78976f0ab7113160343b64a0517ed3c5880eacc.tar.gz
Merge branch 'master' of https://github.com/MoonchildProductions/UXP into js_dom_performance-resource-timing_1
Diffstat (limited to 'security/nss/lib/util/secoid.c')
-rw-r--r--security/nss/lib/util/secoid.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/security/nss/lib/util/secoid.c b/security/nss/lib/util/secoid.c
index a05621c59e..da03b7c06e 100644
--- a/security/nss/lib/util/secoid.c
+++ b/security/nss/lib/util/secoid.c
@@ -1841,11 +1841,13 @@ secoid_FindDynamic(const SECItem *key)
{
SECOidData *ret = NULL;
- NSSRWLock_LockRead(dynOidLock);
if (dynOidHash) {
- ret = (SECOidData *)PL_HashTableLookup(dynOidHash, key);
+ NSSRWLock_LockRead(dynOidLock);
+ if (dynOidHash) { /* must check it again with lock held. */
+ ret = (SECOidData *)PL_HashTableLookup(dynOidHash, key);
+ }
+ NSSRWLock_UnlockRead(dynOidLock);
}
- NSSRWLock_UnlockRead(dynOidLock);
if (ret == NULL) {
PORT_SetError(SEC_ERROR_UNRECOGNIZED_OID);
}
@@ -1864,12 +1866,14 @@ secoid_FindDynamicByTag(SECOidTag tagnum)
}
tagNumDiff = tagnum - SEC_OID_TOTAL;
- NSSRWLock_LockRead(dynOidLock);
- if (dynOidTable != NULL &&
- tagNumDiff < dynOidEntriesUsed) {
- dxo = dynOidTable[tagNumDiff];
+ if (dynOidTable) {
+ NSSRWLock_LockRead(dynOidLock);
+ if (dynOidTable != NULL && /* must check it again with lock held. */
+ tagNumDiff < dynOidEntriesUsed) {
+ dxo = dynOidTable[tagNumDiff];
+ }
+ NSSRWLock_UnlockRead(dynOidLock);
}
- NSSRWLock_UnlockRead(dynOidLock);
if (dxo == NULL) {
PORT_SetError(SEC_ERROR_UNRECOGNIZED_OID);
}