summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtc%netscape.com <devnull@localhost>2002-05-09 23:34:24 +0000
committerwtc%netscape.com <devnull@localhost>2002-05-09 23:34:24 +0000
commit93f92b7a1054172174a2b17d06458294fe74d94c (patch)
tree33d409dba3625fe9559d5ed37cf28745a11bd187
parenta1951570f0ba2554273ccdee7155efa0cb061d6f (diff)
downloadnss-hg-93f92b7a1054172174a2b17d06458294fe74d94c.tar.gz
Bugzilla bug 135821: fixed the internal slot reference leak in
PK11_WrapPrivKey. r=relyea.
-rw-r--r--security/nss/lib/pk11wrap/pk11skey.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/security/nss/lib/pk11wrap/pk11skey.c b/security/nss/lib/pk11wrap/pk11skey.c
index f98a39d87..7955a203e 100644
--- a/security/nss/lib/pk11wrap/pk11skey.c
+++ b/security/nss/lib/pk11wrap/pk11skey.c
@@ -4758,8 +4758,11 @@ PK11_WrapPrivKey(PK11SlotInfo *slot, PK11SymKey *wrappingKey,
privSlot = int_slot; /* The private key has a new home */
newPrivKey = pk11_loadPrivKey(privSlot,privKey,NULL,PR_FALSE,PR_FALSE);
+ /* newPrivKey has allocated its own reference to the slot, so it's
+ * safe until we destroy newPrivkey.
+ */
+ PK11_FreeSlot(int_slot);
if (newPrivKey == NULL) {
- PK11_FreeSlot (int_slot);
return SECFailure;
}
privKey = newPrivKey;