Closed Bug 139325 Opened 24 years ago Closed 24 years ago

Leaking CERTCertificate references from nsNSSCertificate::GetChain

Categories

(Core Graveyard :: Security: UI, defect)

1.0 Branch
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: bryner, Assigned: KaiE)

References

Details

(Whiteboard: [adt1])

Attachments

(1 file, 2 obsolete files)

The following code leaks: while (cert) { nsCOMPtr<nsIX509Cert> pipCert = new nsNSSCertificate(cert); PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("adding %s to chain\n", cert->nickname)); array->AppendElement(pipCert); if (SECITEM_CompareItem(&cert->derIssuer, &cert->derSubject) == SECEqual) break; cert = CERT_FindCertIssuer(cert, PR_Now(), certUsageSSLClient); } because CERT_FindCertIssuer will addref the certificate before handing it back.
Blocks: 125561
Status: NEW → ASSIGNED
Attached patch Suggested fix (obsolete) — Splinter Review
Javi, can you please review?
Attached patch Better fix (obsolete) — Splinter Review
Shame on me, the previous patch introduced a double free for the first cert.
Attachment #80483 - Attachment is obsolete: true
The previous patch didn't compile everywhere, because the existing goto crossed the init location.
Attachment #80489 - Attachment is obsolete: true
Comment on attachment 80491 [details] [diff] [review] Fixed goto init crossing |cert| doesn't strictly need to be initialized to nsnull; remove it if you want to. r=bryner.
Attachment #80491 - Flags: review+
With this patch applied, and the patch in bug 133584 applied, NSS shuts down cleanly (verified by setting NSS_STRICT_SHUTDOWN) after bringing up the cert manager and viewing a certificate.
Brian, you also had the fix from 139349 in your tree, right? Alec, can you please sr= ?
Comment on attachment 80491 [details] [diff] [review] Fixed goto init crossing r=javi
kaie, yes, I have that fix in my tree as well.
Comment on attachment 80491 [details] [diff] [review] Fixed goto init crossing sr=alecf
Attachment #80491 - Flags: superreview+
Keywords: nsbeta1+
Whiteboard: [adt1]
Keywords: adt1.0.0
Update for Scott Putterman. This bug is indeed related to the profile switching work that is taking place. See comment #6 Note also that this bug blocks bug 125561 If the strategy is to try and get NSS to shutdown cleanly always, or at least most of the time then this bug is needed.
Checked in to trunk.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
adt1.0.0+ (on ADT's behalf) approval for checkin on the 1.0 branch. Pls check this in today, then add the fixed1.0.0 keyword.
Keywords: adt1.0.0adt1.0.0+
Verified - through 125561 on Win and Linux
Status: RESOLVED → VERIFIED
Comment on attachment 80491 [details] [diff] [review] Fixed goto init crossing a=scc for checkin to the mozilla 1.0 branch
Attachment #80491 - Flags: approval+
Checked in to branch
Keywords: adt1.0.0+fixed1.0.0
verified1.0.0
Product: PSM → Core
Version: psm1.01 → 1.0 Branch
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: