Last Comment Bug 404919 - memory leak in sftkdb_ReadSecmodDB() (sftkmod.c)
: memory leak in sftkdb_ReadSecmodDB() (sftkmod.c)
Product: NSS
Classification: Components
Component: Libraries (show other bugs)
: trunk
: x86 SunOS
: -- normal (vote)
: 3.12
Assigned To: nobody
: 401072 (view as bug list)
Depends on:
  Show dependency treegraph
Reported: 2007-11-21 23:15 PST by Boying Lu
Modified: 2008-01-21 16:03 PST (History)
2 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---

patch (362 bytes, patch)
2007-11-21 23:19 PST, Boying Lu
no flags Details | Diff | Splinter Review
mv label "bail" into the "if" block (458 bytes, patch)
2007-11-22 18:41 PST, Boying Lu
wtc: review+
Details | Diff | Splinter Review
mv label "bail" into the "if" block (as checked in) (668 bytes, patch)
2007-11-27 18:41 PST, Wan-Teh Chang
no flags Details | Diff | Splinter Review

Description Boying Lu 2007-11-21 23:15:19 PST
Using solaris memory leak detection tool, I found a memory leak in sftkdb_ReadSecmodDB().  Here is the related output of
                 unsigned nsNSSComponent::InitializeNSS+0x18e
                 unsigned nsNSSComponent::Init+0x15a
                 unsigned nsNSSComponentConstructor+0x9f
       `unsigned nsGenericFactory::CreateInstance+0x46
Test Case:
1. firefox -P
2. click "Exit" button
Comment 1 Boying Lu 2007-11-21 23:19:02 PST
Created attachment 289785 [details] [diff] [review]
Comment 2 Wan-Teh Chang 2007-11-22 09:21:12 PST
Comment on attachment 289785 [details] [diff] [review]

We also need to free olddbname at the other
exit points of the if block.

We can move the "bail" label into the if block,
and free olddbname there, like this:

        if (olddbname) {
Comment 3 Boying Lu 2007-11-22 18:41:47 PST
Created attachment 289875 [details] [diff] [review]
mv label "bail" into the "if" block

Thanks for the comment. I re-made the patch
Comment 4 Wan-Teh Chang 2007-11-22 22:48:51 PST
Comment on attachment 289875 [details] [diff] [review]
mv label "bail" into the "if" block


I will fix the indentation when I check in
the patch.  In NSS, we indent by four spaces.
Comment 5 Wan-Teh Chang 2007-11-27 18:41:18 PST
Created attachment 290488 [details] [diff] [review]
mv label "bail" into the "if" block (as checked in)

I checked in this patch on the NSS trunk for NSS 3.12.

Checking in sftkmod.c;
/cvsroot/mozilla/security/nss/lib/softoken/sftkmod.c,v  <--  sftkmod.c
new revision: 1.2; previous revision: 1.1
Comment 6 Robert Relyea 2008-01-21 16:03:38 PST
*** Bug 401072 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.