From 8b2bc6b9d6530a3fe3a1254be1025846e3bd8584 Mon Sep 17 00:00:00 2001 From: "wtc%netscape.com" Date: Wed, 2 May 2001 18:50:07 +0000 Subject: [PATCH] Bugzilla bug #78467: fixed a memory leak in SECMOD_AddNewModule(). Thanks to Patrick Beard for the bug report. --- security/nss/lib/pk11wrap/pk11util.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/security/nss/lib/pk11wrap/pk11util.c b/security/nss/lib/pk11wrap/pk11util.c index f300f5adb34b..24dd5cb96510 100644 --- a/security/nss/lib/pk11wrap/pk11util.c +++ b/security/nss/lib/pk11wrap/pk11util.c @@ -482,7 +482,7 @@ SECStatus SECMOD_AddNewModule(char* moduleName, char* dllPath, unsigned long defaultMechanismFlags, unsigned long cipherEnableFlags) { SECMODModule *module; - SECStatus result; + SECStatus result = SECFailure; int s,i; PK11SlotInfo* slot; @@ -502,12 +502,8 @@ SECStatus SECMOD_AddNewModule(char* moduleName, char* dllPath, if (module->dllName != NULL) { if (module->dllName[0] != 0) { - SECStatus rv = SECMOD_AddModule(module); - if (rv != 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 */ + result = SECMOD_AddModule(module); + if (result == SECSuccess) { /* turn on SSL cipher enable flags */ module->ssl[0] = cipherEnableFlags; @@ -544,7 +540,7 @@ SECStatus SECMOD_AddNewModule(char* moduleName, char* dllPath, } } SECMOD_DestroyModule(module); - return SECFailure; + return result; } /* Public & Internal(Security Library) representation of