Index: nss/mozilla/security/nss/lib/certdb/stanpcertdb.c |
=================================================================== |
--- nss/mozilla/security/nss/lib/certdb/stanpcertdb.c (revision 142244) |
+++ nss/mozilla/security/nss/lib/certdb/stanpcertdb.c (working copy) |
@@ -311,13 +311,15 @@ |
} |
stanNick = nssCertificate_GetNickname(c, NULL); |
if (stanNick && nickname && strcmp(nickname, stanNick) != 0) { |
- /* take the new nickname */ |
+ /* different: take the new nickname */ |
cert->nickname = NULL; |
+ nss_ZFreeIf(stanNick); |
stanNick = NULL; |
} |
if (!stanNick && nickname) { |
- stanNick = nssUTF8_Duplicate((NSSUTF8 *)nickname, c->object.arena); |
- } |
+ /* Either there was no nickname yet, or we have a new nickname */ |
+ stanNick = nssUTF8_Duplicate((NSSUTF8 *)nickname, NULL); |
+ } /* else: old stanNick is identical to new nickname */ |
/* Delete the temp instance */ |
nssCertificateStore_Lock(context->certStore, &lockTrace); |
nssCertificateStore_RemoveCertLOCKED(context->certStore, c); |
@@ -336,6 +338,8 @@ |
&c->serial, |
cert->emailAddr, |
PR_TRUE); |
+ nss_ZFreeIf(stanNick); |
+ stanNick = NULL; |
PK11_FreeSlot(slot); |
if (!permInstance) { |
if (NSS_GetError() == NSS_ERROR_INVALID_CERTIFICATE) { |