Commit b1d074b7 authored by David Woodhouse's avatar David Woodhouse

From b3a543fc2616501555997d7caf857a74c9c197a7 Mon Sep 17 00:00:00 2001

Bug 1162897,  Make NSSTrustDomain_FindTokenByName() take a ref on the token it returns, r=rrelyea
parent 268cb85f
......@@ -512,7 +512,7 @@ find_certs_from_nickname(const char *nickname, void *wincx)
{
PRStatus status;
NSSCertificate **certs = NULL;
NSSToken *token;
NSSToken *token = NULL;
NSSTrustDomain *defaultTD = STAN_GetDefaultTrustDomain();
PK11SlotInfo *slot = NULL;
SECStatus rv;
......@@ -539,7 +539,7 @@ find_certs_from_nickname(const char *nickname, void *wincx)
*delimit = ':';
} else {
slot = PK11_GetInternalKeySlot();
token = PK11Slot_GetNSSToken(slot);
token = nssToken_AddRef(PK11Slot_GetNSSToken(slot));
}
if (token) {
nssList *certList;
......@@ -600,6 +600,9 @@ find_certs_from_nickname(const char *nickname, void *wincx)
nssList_Destroy(certList);
}
loser:
if (token) {
nssToken_Destroy(token);
}
if (slot) {
PK11_FreeSlot(slot);
}
......
......@@ -248,8 +248,10 @@ NSSTrustDomain_FindTokenByName(
tok = (NSSToken *)nssListIterator_Next(td->tokens)) {
if (nssToken_IsPresent(tok)) {
myName = nssToken_GetName(tok);
if (nssUTF8_Equal(tokenName, myName, &nssrv))
if (nssUTF8_Equal(tokenName, myName, &nssrv)) {
tok = nssToken_AddRef(tok);
break;
}
}
}
nssListIterator_Finish(td->tokens);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment