diff options
author | wtc%netscape.com <devnull@localhost> | 2000-10-02 23:23:50 +0000 |
---|---|---|
committer | wtc%netscape.com <devnull@localhost> | 2000-10-02 23:23:50 +0000 |
commit | e612130bacb5ff5f7c5e4ea1b4a4ee1c12305e93 (patch) | |
tree | 86fba56d3dbe74e0f68d35851640d76afd20d44a | |
parent | 35adafd884fa619a12b978faa8669a1e4e290ed0 (diff) | |
download | nss-hg-e612130bacb5ff5f7c5e4ea1b4a4ee1c12305e93.tar.gz |
Bugzilla bug #49477: fixed memory leak in CERT_OpenCertDB. Have
certDBFilenameCallback duplicate the filename string so that its
return value can be freed.
-rw-r--r-- | security/nss/lib/certdb/pcertdb.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/security/nss/lib/certdb/pcertdb.c b/security/nss/lib/certdb/pcertdb.c index 72e97116a..3854f895e 100644 --- a/security/nss/lib/certdb/pcertdb.c +++ b/security/nss/lib/certdb/pcertdb.c @@ -4206,6 +4206,7 @@ SEC_OpenPermCertDB(CERTCertDBHandle *handle, PRBool readOnly, } else if ( versionEntry->common.version != CERT_DB_FILE_VERSION ) { /* wrong version number, can't update in place */ DestroyDBEntry((certDBEntry *)versionEntry); + PORT_Free(certdbname); return(SECFailure); } @@ -4300,6 +4301,8 @@ SEC_OpenPermCertDB(CERTCertDBHandle *handle, PRBool readOnly, } rv = CERT_AddNewCerts(handle); + + PORT_Free(certdbname); return (SECSuccess); @@ -4312,6 +4315,8 @@ loser: handle->permCertDB = 0; } + PORT_Free(certdbname); + return(SECFailure); } @@ -4812,7 +4817,7 @@ loser: static char * certDBFilenameCallback(void *arg, int dbVersion) { - return((char *)arg); + return(PORT_Strdup((char *)arg)); } SECStatus |