The default bug view has changed. See this FAQ.

mem leak whenever SECMOD_HANDLE_STRING_ARG called in loop

RESOLVED FIXED in 3.12

Status

NSS
Libraries
P2
normal
RESOLVED FIXED
11 years ago
11 years ago

People

(Reporter: Nelson Bolyard (seldom reads bugmail), Assigned: Nelson Bolyard (seldom reads bugmail))

Tracking

({coverity})

3.11
3.12
coverity

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: FIPS)

Attachments

(2 attachments)

Coverity CIDs 578 and 579
In source file lib/softoken/pk11db.c, there are numerous places where we 
find loops containing one or more invocations of the SECMOD_HANDLE_STRING_ARG
macro.  That macro checks for a string match, then allocates memory for a copy
of a string, and stores the allocated memory address in a target pointer. 
If the same macro invocation should occur twice in the loop, e.g. because the
sought string occurred more than once in the source string, all but the last
allocation of the corresponding value string would be leaked.  

Coverity reports 11 occurrences of this in all, one for each macro invocation.

The most straightforward solution is to have that macro free the contents of
the target pointer, if it is not already NULL.  patch forthcoming.
(Assignee)

Comment 1

11 years ago
Created attachment 223256 [details] [diff] [review]
patch v1

Bob, please review.
Attachment #223256 - Flags: review?(rrelyea)

Comment 2

11 years ago
Comment on attachment 223256 [details] [diff] [review]
patch v1

r= rrelya
Attachment #223256 - Flags: review?(rrelyea) → review+
(Assignee)

Comment 3

11 years ago
Created attachment 223507 [details] [diff] [review]
patch v1, part 2

OOps, that patch had two parts, and I previously only attached one of them.
So please review this part, also, as if the two parts are being reviewed 
together.
Attachment #223507 - Flags: review?(rrelyea)
(Assignee)

Updated

11 years ago
Attachment #223507 - Flags: review?(alexei.volkov.bugs)

Comment 4

11 years ago
Comment on attachment 223507 [details] [diff] [review]
patch v1, part 2

r=alexei
Attachment #223507 - Flags: review?(alexei.volkov.bugs) → review+
(Assignee)

Comment 5

11 years ago
So, Wan-Teh, is it too late for softoken fixes like this one now?
Whiteboard: FIPS
(Assignee)

Updated

11 years ago
Priority: -- → P2
Target Milestone: --- → 3.11.2
(Assignee)

Comment 6

11 years ago
Retargetting this bug to NSS 3.12 because it is a softoken change, and we
don't want to trigger more FIPS work.
Target Milestone: 3.11.2 → 3.12

Comment 7

11 years ago
Comment on attachment 223507 [details] [diff] [review]
patch v1, part 2

r=rrelyea
Attachment #223507 - Flags: review?(rrelyea) → review+

Comment 8

11 years ago
Nelson, if you want, you can check in this patch on
the NSS_3_11_BRANCH before this Friday.
(Assignee)

Comment 9

11 years ago
Committed on trunk.

Checking in pk11db.c;   new revision: 1.37; previous revision: 1.36
Checking in pk11pars.h; new revision: 1.21; previous revision: 1.20
Status: NEW → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.