diff options
author | Franziskus Kiefer <franziskuskiefer@gmail.com> | 2015-10-16 15:57:01 -0700 |
---|---|---|
committer | Franziskus Kiefer <franziskuskiefer@gmail.com> | 2015-10-16 15:57:01 -0700 |
commit | 754958e1f9729d88c04f8da68fdf304be227647d (patch) | |
tree | 5178574a9e9003793617ab3a2a6fe522d38f9715 /lib | |
parent | d257873834b58da618705a8ba25bc261c7b8b1a9 (diff) | |
download | nss-hg-754958e1f9729d88c04f8da68fdf304be227647d.tar.gz |
Bug 1214829 - [CID 749513] leaked_storage: Variable filename going out of scope leaks the storage it points to, r=mt
Diffstat (limited to 'lib')
-rw-r--r-- | lib/softoken/pkcs11.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/softoken/pkcs11.c b/lib/softoken/pkcs11.c index 24bfaca1a..97d6d3f37 100644 --- a/lib/softoken/pkcs11.c +++ b/lib/softoken/pkcs11.c @@ -2761,7 +2761,7 @@ NSC_ModuleDBFunc(unsigned long function,char *parameters, void *args) case SECMOD_MODULE_DB_FUNCTION_FIND: if (secmod == NULL) { PORT_SetError(SEC_ERROR_INVALID_ARGS); - return NULL; + goto loser; } if (rw && (dbType != NSS_DB_TYPE_LEGACY) && (dbType != NSS_DB_TYPE_MULTIACCESS)) { @@ -2804,7 +2804,7 @@ NSC_ModuleDBFunc(unsigned long function,char *parameters, void *args) case SECMOD_MODULE_DB_FUNCTION_ADD: if (secmod == NULL) { PORT_SetError(SEC_ERROR_INVALID_ARGS); - return NULL; + goto loser; } rvstr = (sftkdbCall_AddSecmodDB(appName,filename,secmod, (char *)args,rw) == SECSuccess) ? &success: NULL; @@ -2812,7 +2812,7 @@ NSC_ModuleDBFunc(unsigned long function,char *parameters, void *args) case SECMOD_MODULE_DB_FUNCTION_DEL: if (secmod == NULL) { PORT_SetError(SEC_ERROR_INVALID_ARGS); - return NULL; + goto loser; } rvstr = (sftkdbCall_DeleteSecmodDB(appName,filename,secmod, (char *)args,rw) == SECSuccess) ? &success: NULL; @@ -2822,6 +2822,8 @@ NSC_ModuleDBFunc(unsigned long function,char *parameters, void *args) (char **)args,rw) == SECSuccess) ? &success: NULL; break; } + +loser: if (secmod) PR_smprintf_free(secmod); if (appName) PORT_Free(appName); if (filename) PORT_Free(filename); |