Closed Bug 341114 Opened 18 years ago Closed 18 years ago

Coverity 517 SECU_ParseCommandLine leaks optstate

Categories

(NSS :: Tools, defect, P3)

3.11.1

Tracking

(Not tracked)

RESOLVED FIXED
3.11.3

People

(Reporter: nelson, Assigned: alvolkov.bgs)

Details

(Keywords: coverity, Whiteboard: CID 517)

Attachments

(1 file, 1 obsolete file)

SECU_ParseCommandLine allocates an "optstate" and returns without destroying it.  
It should call PL_DestroyOptState(optstate) to destroy it.
CID 517
Summary: SECU_ParseCommandLine leaks optstate → Coverity 517 SECU_ParseCommandLine leaks optstate
Whiteboard: CID 517
Assignee: nobody → alexei.volkov.bugs
Attached patch fix v1 (obsolete) — Splinter Review
Deallocate optstate as well as optstring.
Attachment #226883 - Flags: review?(nelson)
Comment on attachment 226883 [details] [diff] [review]
fix v1

>     optstring[j] = '\0';
>     optstate = PL_CreateOptState(argc, argv, optstring);
>+    if (!optstate) {

optstring is leaked here.

>+        return SECFailure;
>+    }
Attachment #226883 - Attachment description: fix → fix v1
Attachment #226883 - Flags: review?(nelson) → review-
Attachment #226883 - Attachment is obsolete: true
Attachment #227163 - Flags: review?(nelson)
Comment on attachment 227163 [details] [diff] [review]
free optstring if optstate allocation fails

Don't indent loser.  r=nelson
>+
>+  loser:
>+    PL_DestroyOptState(optstate);
Attachment #227163 - Flags: review?(nelson) → review+
Priority: -- → P3
Target Milestone: --- → 3.11.3
/cvsroot/mozilla/security/nss/cmd/lib/secutil.c,v  <--  secutil.c
new revision: 1.74; previous revision: 1.73
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: