Closed Bug 135058 Opened 23 years ago Closed 23 years ago

Leaked slot references in lib/pk11wrap/pk11cert.c

Categories

(NSS :: Libraries, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: wtc, Assigned: bugz)

References

Details

(Whiteboard: [adt2 RTM])

Attachments

(1 file, 1 obsolete file)

In PK11_FindCertFromNickname(), there are two places where we return NULL without calling PK11_FreeSlot(). 1. if (!PK11_IsPresent(slot)) { return NULL; } 2. /* find matching certs on the token */ certList = nssList_Create(NULL, PR_FALSE); if (!certList) return NULL; It seems that the slot reference would be leaked.
PK11_FindCertsFromNickname() in the same file has the same problem. It does not free the slot reference here: 1554 if (!nameList) return NULL;
PK11_SaveSMimeProfile() calls PK11_GetInternalKeySlot() but does not free the slot reference. There is a comment that says it should be done :-) 3988 if (slot == NULL) { 3989 slot = PK11_GetInternalKeySlot(); 3990 /* we need to free the key slot in the end!!! */ 3991 }
Summary: Leaked slot reference in PK11_FindCertFromNickname() → Leaked slot references in lib/pk11wrap/pk11cert.c
Attached patch Proposed patch (obsolete) — Splinter Review
I decided to use "goto loser" in PK11_FindCertFromNickname and PK11_FindCertsFromNickname because they also need to free 'nickCopy' before returning.
Changed the QA contact to Bishakha.
QA Contact: sonja.mirtitsch → bishakhabanerjee
I verified that in the current revision (1.80) of pk11cert.c all the slot reference leaks I reported have been fixed. The only thing left to do is to free the string 'nickCopy' on error returns in PK11_FindCertsFromNickname, which is what this patch does. Please review. Thanks.
Attachment #78484 - Attachment is obsolete: true
Priority: -- → P1
Target Milestone: --- → 3.5
Attachment #82880 - Flags: review+
Patch checked into the tip of NSS.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Blocks: 145836
adt1.0.1+ (on ADT's behalf) for checkin to the 1.0 branch. Pls check this in asap. thanks!
Keywords: adt1.0.1+, nsbeta1+
Whiteboard: [adt2 RTM]
Keywords: adt1.0.1+fixed1.0.1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: