Bugzilla bug #78467: fixed a memory leak in SECMOD_AddNewModule(). Thanks

to Patrick Beard <beard@netscape.com> for the bug report.
This commit is contained in:
wtc%netscape.com 2001-05-02 18:50:07 +00:00
parent e8890d91a2
commit 8b2bc6b9d6

View File

@ -482,7 +482,7 @@ SECStatus SECMOD_AddNewModule(char* moduleName, char* dllPath,
unsigned long defaultMechanismFlags, unsigned long defaultMechanismFlags,
unsigned long cipherEnableFlags) { unsigned long cipherEnableFlags) {
SECMODModule *module; SECMODModule *module;
SECStatus result; SECStatus result = SECFailure;
int s,i; int s,i;
PK11SlotInfo* slot; PK11SlotInfo* slot;
@ -502,12 +502,8 @@ SECStatus SECMOD_AddNewModule(char* moduleName, char* dllPath,
if (module->dllName != NULL) { if (module->dllName != NULL) {
if (module->dllName[0] != 0) { if (module->dllName[0] != 0) {
SECStatus rv = SECMOD_AddModule(module); result = SECMOD_AddModule(module);
if (rv != SECSuccess) { if (result == SECSuccess) {
/* SECFailure: failed to add module, corrupt or missing module etc. */
/* SECBlock: a module with the same name already exists */
return rv;
} else { /* successfully added module */
/* turn on SSL cipher enable flags */ /* turn on SSL cipher enable flags */
module->ssl[0] = cipherEnableFlags; module->ssl[0] = cipherEnableFlags;
@ -544,7 +540,7 @@ SECStatus SECMOD_AddNewModule(char* moduleName, char* dllPath,
} }
} }
SECMOD_DestroyModule(module); SECMOD_DestroyModule(module);
return SECFailure; return result;
} }
/* Public & Internal(Security Library) representation of /* Public & Internal(Security Library) representation of