Closed Bug 339919 Opened 19 years ago Closed 19 years ago

Coverity 905, leak in CERT_GetCertNicknames

Categories

(NSS :: Libraries, defect, P2)

3.11.1
defect

Tracking

(Not tracked)

RESOLVED FIXED
3.11.2

People

(Reporter: nelson, Assigned: nelson)

Details

(Keywords: coverity, memory-leak, Whiteboard: [CID 465 905])

Attachments

(1 file)

Coverity CID 905 The leak is actually in static function CollectNicknames, called from CERT_GetCertNicknames in file nss/lib/certhigh/certhigh.c . If variable "saveit" is true (non-zero) and the cert's nickname is not found in the linked list of nickname "stringnodes", and our attempt to allocate a new stringNode from the names->arena fails, then we return PR_FAILURE without freeing nickname, leaking nickname. Solution is to unconditionally PORT_Free(nickname) in that error path.
Status: NEW → ASSIGNED
Priority: -- → P2
Target Milestone: --- → 3.11.2
Attached patch patch v1Splinter Review
Patch Also eliminates a "use before null check" error.
Attachment #224828 - Flags: review?
Attachment #224828 - Flags: review? → review?(alexei.volkov.bugs)
Comment on attachment 224828 [details] [diff] [review] patch v1 r=alexei
Attachment #224828 - Flags: review?(alexei.volkov.bugs) → review+
Fix leaks in CERT_DistNamesFromNicknames (bug 339916) and in CERT_GetCertNicknames (bug 339919). Coverity bugs. r=alexei.volkov Checking in certhigh.c; new revision: 1.34.2.3; previous revision: 1.34.2.2 Checking in certhigh.c; new revision: 1.37; previous revision: 1.36
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Also Coverity CID 465
Whiteboard: [CID 465 905]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: