Closed Bug 398401 Opened 17 years ago Closed 17 years ago

Memory leak in PKIX init.

Categories

(NSS :: Libraries, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

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

Details

(Whiteboard: PKIX)

Attachments

(1 file, 1 obsolete file)

I tested memory leaks with PKIX init + shutdown process (see bug 391774 where shutdown was not called). Also with shutdown there is still one leak: Block in use (biu): Found block of size 88 bytes at address 0x8180a00 (2.65% of total) At time of allocation, the call stack was: [1] calloc() at 0xb4d308a0 [2] PR_Calloc() at line 475 in "prmem.c" [3] PR_NewLock() at line 174 in "ptsynch.c" [4] PKIX_PL_Initialize() at line 114 in "pkix_pl_lifecycle.c" [5] PKIX_Initialize() at line 124 in "pkix_lifecycle.c" [6] nss_Init() at line 523 in "nssinit.c" [7] NSS_Initialize() at line 614 in "nssinit.c" [8] main() at line 1915 in "selfserv.c" Found in selfserv, strsclnt, ocspclnt.
Stacks (there are 2, differs a bit on platforms) removed from bug 391774 and assigned to this bug in ignore list.
Attached patch Patch v1 (obsolete) — Splinter Review
Destroy lock at shutdown. Also, to not return error if library is already initialized. Code clean up.
Attachment #283566 - Flags: review?(nelson)
Priority: -- → P1
Whiteboard: PKIX
Target Milestone: --- → 3.12
Version: 3.12 → trunk
Comment on attachment 283566 [details] [diff] [review] Patch v1 The changes to the executable code are OK, but the changes make the block comments that precede them be completely wrong. The comments need to be fixed, too. >@@ -109,21 +109,22 @@ PKIX_Initialize( > /* > * If we are called a second time other than in the situation handled > * above, we return a statically allocated error. Our technique works > * most of the time, but may not work if multiple threads call this > * function simultaneously. However, the function's documentation > * makes it clear that this is prohibited, so it's not our > * responsibility. > */ > > if (pkixIsInitialized){ >- return (PKIX_ALLOC_ERROR()); >+ /* Already initialized */ >+ PKIX_RETURN(LIFECYCLE); > } >@@ -102,24 +102,28 @@ PKIX_PL_Initialize( > > /* > * This function can only be called once. If it has already been > * called, we return a statically allocated error. Our technique works > * most of the time, but may not work if multiple threads call this > * function simultaneously. However, the function's documentation > * makes it clear that this is prohibited, so it's not our > * responsibility. > */ > >- if (pkix_pl_initialized) return (PKIX_ALLOC_ERROR()); >+ if (pkix_pl_initialized) { >+ PKIX_RETURN(OBJECT); >+ }
Attachment #283566 - Flags: review?(nelson) → review-
Attachment #283566 - Attachment is obsolete: true
Attachment #283729 - Flags: review?(nelson)
Comment on attachment 283729 [details] [diff] [review] Patch v2. Changes in comment blocks. Strike all the following text from both places. > Our technique works > * most of the time, but may not work if multiple threads call this > * function simultaneously. However, the function's documentation > * makes it clear that this is prohibited, so it's not our > * responsibility.
Attachment #283729 - Flags: review?(nelson) → review-
Comment on attachment 283729 [details] [diff] [review] Patch v2. Changes in comment blocks. Alexei, When you make the changes described in my previous comment, then r+
Attachment #283729 - Flags: review- → review+
patch has been integrated with fixed comment blocks.
Status: NEW → 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: