Closed Bug 741481 Opened 12 years ago Closed 12 years ago

cert_InitLocks does not properly reset certRefCountLock to NULL after calling PZ_DestroyLock(certRefCountLock)

Categories

(NSS :: Libraries, defect, P2)

3.11.9
defect

Tracking

(Not tracked)

VERIFIED FIXED
3.13.4

People

(Reporter: benchan, Assigned: benchan)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.142 Safari/535.19

Steps to reproduce:

By going through the cert_InitLocks in nss-3.13.3/mozilla/security/nss/lib/certdb/certdb.c

SECStatus
cert_InitLocks(void)
{
    if ( certRefCountLock == NULL ) {
        certRefCountLock = PZ_NewLock(nssILockRefLock);
        PORT_Assert(certRefCountLock != NULL);
        if (!certRefCountLock) {
            return SECFailure;
        }
    }

    if ( certTrustLock == NULL ) {
        certTrustLock = PZ_NewLock(nssILockCertDB);
        PORT_Assert(certTrustLock != NULL);
        if (!certTrustLock) {
            PZ_DestroyLock(certRefCountLock);
            return SECFailure;
        }
    }    

    return SECSuccess;
}


Actual results:

certRefCountLock holds a reference to the lock that may have been destroyed by PZ_DestroyLock(certRefCountLock).


Expected results:

certRefCountLock should be reset to NULL after PZ_DestroyLock(certRefCountLock) is called.
Attachment #611526 - Attachment is patch: true
Attachment #611526 - Flags: review?(wtc)
Comment on attachment 611526 [details] [diff] [review]
cert_init_locks.patch

r=wtc.  Thanks for the patch.

Patch checked in on the NSS trunk and NSS_3_13_4_BRANCH
for NSS 3.13.4.

Checking in certdb.c;
/cvsroot/mozilla/security/nss/lib/certdb/certdb.c,v  <--  certdb.c
new revision: 1.122; previous revision: 1.121
done

Checking in certdb.c;
/cvsroot/mozilla/security/nss/lib/certdb/certdb.c,v  <--  certdb.c
new revision: 1.121.2.1; previous revision: 1.121
done
Attachment #611526 - Flags: review?(wtc) → review+
This bug was introduced in the fix for bug 399304.
Assignee: nobody → benchan
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Priority: -- → P2
Resolution: --- → FIXED
Target Milestone: --- → 3.13.4
Version: 3.13.3 → 3.11.9
Verified that the patch has been committed to NSS trunk and NSS_3_13_4_BRANCH. Thanks!
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: