Closed Bug 93989 Opened 23 years ago Closed 23 years ago

memory leak in SECMOD_AddModule()

Categories

(NSS :: Libraries, defect, P2)

x86
Windows 2000
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jeff, Assigned: rrelyea)

References

Details

(Keywords: memory-leak)

in security/nss/lib/pk11wrap/pk11util.c::SECMOD_AddModule(),
the call to _FindModule() returns a 'referenced' module.  this
return value is discarded and hence the reference count is off
and the module gets leaked later during cleanup.

consider adding the following change:

#if 1//begin JLH fix
    SECMODModule * pOldModule = SECMOD_FindModule(newModule->commonName);
    if (pOldModule) {
	/* _FindModule() increased the ref count, so we need to undo it. */
	SECMOD_DestroyModule(pOldModule);
        return SECWouldBlock;
        /* module already exists. */
    }
#else //the old way
    if (SECMOD_FindModule(newModule->commonName)) {
        return SECWouldBlock;
        /* module already exists. */
    }
#endif//end JLH fix
Need review of patch. thanks for the patch reporter.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: mlk, patch, review
Assigned the bug to Bob.
Assignee: wtc → relyea
Blocks: 92580
No longer blocks: 92580
Priority: -- → P2
Target Milestone: --- → 3.4
Fixed in NSS 3.4
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.