Closed Bug 165863 Opened 23 years ago Closed 23 years ago

Memory leaks on error paths in nssTrustDomain_FindTrustForCertificate

Categories

(NSS :: Libraries, defect, P4)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: wtc, Assigned: bugz)

Details

Attachments

(1 file)

In trustdomain.c, function nssTrustDomain_FindTrustForCertificate, 'token' is leaked on some error paths. Here is the code fragment. 'token' is not destroyed if either of the 'goto loser' statements is taken. Also, it seems that 'to' is not destroyed. token = nssSlot_GetToken(*slotp); if (token) { to = nssToken_FindTrustForCertificate(token, NULL, &c->encoding, &c->issuer, &c->serial, nssTokenSearchType_TokenOnly); if (to) { if (!pkio) { pkio = nssPKIObject_Create(NULL, to, td, NULL); if (!pkio) { goto loser; } } else { status = nssPKIObject_AddInstance(pkio, to); if (status != PR_SUCCESS) { goto loser; } } } nssToken_Destroy(token); }
"to" is freed, I moved it up to make it more clear in the error paths. In the success path, "to" becomes part of the PKIObject. It will be freed with the PKIObject.
fixed on tip (3.6)
Status: NEW → RESOLVED
Closed: 23 years ago
Priority: -- → P4
Resolution: --- → FIXED
Target Milestone: --- → 3.6
Comment on attachment 97637 [details] [diff] [review] free the token in error paths r=wtc.
Attachment #97637 - Flags: review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: