Closed Bug 366557 Opened 18 years ago Closed 17 years ago

Small memory leaks in selfserv.

Categories

(NSS :: Tools, defect, P4)

3.11.4

Tracking

(Not tracked)

RESOLVED FIXED
3.11.7

People

(Reporter: slavomir.katuscak+mozilla, Assigned: alvolkov.bgs)

Details

(Keywords: memory-leak)

Attachments

(2 files, 2 obsolete files)

Selfserv uses strdup() when parsing command line options and this memory is never released. It's just small amount of memory, but these leaks shows up in every memory leak test.
Priority: -- → P4
Keywords: mlk
Attached patch fix for main/strdup leaks (obsolete) — Splinter Review
Assignee: nobody → alexei.volkov.bugs
Status: NEW → ASSIGNED
Attachment #257445 - Flags: review?(neil.williams)
Target Milestone: --- → 3.11.7
Attachment #257445 - Attachment is obsolete: true
Attachment #257447 - Flags: review?(neil.williams)
Attachment #257445 - Flags: review?(neil.williams)
committed into trunk: /cvsroot/mozilla/security/nss/cmd/selfserv/selfserv.c,v <-- selfserv.c new revision: 1.76; previous revision: 1.75
Attachment #257447 - Flags: review?(neil.williams) → review+
It's crashing, here is the stack: (gdb) bt #0 0x00000032561691d6 in free () from /lib64/tls/libc.so.6 #1 0x0000002a95bc9503 in PR_Free (ptr=0x413275) at ../../../../pr/src/malloc/prmem.c:490 #2 0x0000002a9584f720 in PORT_Free (ptr=0x413275) at secport.c:152 #3 0x0000000000408f5e in main (argc=15, argv=0x7fbfffeeb8) at selfserv.c:2056 /share/builds/mccrel3/security/securitytip/builds/20070313.1/wozzeck_Solaris8/mozilla/tests_results/security/nssamdrhel4.3/client full of cores.
This core found on Linux 2.6 (nssamdrhel4), 64bit DBG build.
Did check how certPrefix was initialized. Assumed it to be inited NULL. Instead it was initialized with stack allocated empty string.
Attachment #258472 - Flags: review?(nelson)
Comment on attachment 258472 [details] [diff] [review] fix selfserv crash created by prev patch I'd like to suggest a simpler patch for this. Here is an outline of it. > PRBool debugCache = PR_FALSE; /* bug 90518 */ >+ char emptyString[] = { "" }; > char* certPrefix = emptyString; >- if (certPrefix) { >+ if (certPrefix && certPrefix != emptyString) { > PORT_Free(certPrefix); > }
Attachment #258472 - Flags: review?(nelson) → review-
Attachment #258472 - Attachment is obsolete: true
Attachment #258480 - Flags: review?(nelson)
Comment on attachment 258480 [details] [diff] [review] patch with suggested fix r=nelson
Attachment #258480 - Flags: review?(nelson) → review+
Comment on attachment 258480 [details] [diff] [review] patch with suggested fix second review for the branch
Attachment #258480 - Flags: superreview?(neil.williams)
/cvsroot/mozilla/security/nss/cmd/selfserv/selfserv.c,v <-- selfserv.c new revision: 1.77; previous revision: 1.76
Comment on attachment 258480 [details] [diff] [review] patch with suggested fix r=naw
Attachment #258480 - Flags: superreview?(neil.williams) → superreview+
Alexei, is this fixed ? If so, please check into the branch and close the bug. Thanks.
both fixes are checked into 3.11 branch.
Status: ASSIGNED → RESOLVED
Closed: 17 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: