Bugzilla bug 225373: the return value of CERT_NameToAscii must be freed

with PORT_Free.
Modified Files:
	cmd/lib/secutil.c cmd/selfserv/selfserv.c
	cmd/signver/pk7print.c cmd/strsclnt/strsclnt.c
	cmd/tstclnt/tstclnt.c lib/certdb/cert.h
This commit is contained in:
wchang0222%aol.com 2003-11-13 16:10:45 +00:00
parent 8617e98887
commit 4868d7e8c2
6 changed files with 14 additions and 11 deletions

View File

@ -1719,10 +1719,11 @@ SECU_PrintExtensions(FILE *out, CERTCertExtension **extensions,
void
SECU_PrintName(FILE *out, CERTName *name, char *msg, int level)
{
char *nameStr;
char *str;
SECItem my;
str = CERT_NameToAscii(name);
str = nameStr = CERT_NameToAscii(name);
if (!str)
str = "!Invalid AVA!";
my.data = (unsigned char *)str;
@ -1734,7 +1735,7 @@ SECU_PrintName(FILE *out, CERTName *name, char *msg, int level)
fprintf(out, str);
secu_Newline(out);
#endif
PORT_Free(str);
PORT_Free(nameStr);
}
void

View File

@ -381,11 +381,11 @@ printSecurityInfo(PRFileDesc *fd)
char * sp = CERT_NameToAscii(&cert->subject);
if (sp) {
FPRINTF(stderr, "selfserv: subject DN: %s\n", sp);
PR_Free(sp);
PORT_Free(sp);
}
if (ip) {
FPRINTF(stderr, "selfserv: issuer DN: %s\n", ip);
PR_Free(ip);
PORT_Free(ip);
}
CERT_DestroyCertificate(cert);
cert = NULL;

View File

@ -214,6 +214,7 @@ sv_PrintName(FILE *out, CERTName *name, char *msg)
str = CERT_NameToAscii(name);
fprintf(out, "%s%s\n", msg, str);
PORT_Free(str);
}

View File

@ -320,11 +320,11 @@ printSecurityInfo(PRFileDesc *fd)
char * sp = CERT_NameToAscii(&cert->subject);
if (sp) {
fprintf(stderr, "strsclnt: subject DN: %s\n", sp);
PR_Free(sp);
PORT_Free(sp);
}
if (ip) {
fprintf(stderr, "strsclnt: issuer DN: %s\n", ip);
PR_Free(ip);
PORT_Free(ip);
}
}
if (cert) {

View File

@ -189,11 +189,11 @@ void printSecurityInfo(PRFileDesc *fd)
char * sp = CERT_NameToAscii(&cert->subject);
if (sp) {
fprintf(stderr, "subject DN: %s\n", sp);
PR_Free(sp);
PORT_Free(sp);
}
if (ip) {
fprintf(stderr, "issuer DN: %s\n", ip);
PR_Free(ip);
PORT_Free(ip);
}
CERT_DestroyCertificate(cert);
cert = NULL;

View File

@ -34,7 +34,7 @@
/*
* cert.h - public data structures and prototypes for the certificate library
*
* $Id: cert.h,v 1.40 2003/11/04 01:48:39 nelsonb%netscape.com Exp $
* $Id: cert.h,v 1.41 2003/11/13 16:10:45 wchang0222%aol.com Exp $
*/
#ifndef _CERT_H_
@ -66,13 +66,14 @@ extern CERTName *CERT_AsciiToName(char *string);
/*
** Convert an CERTName into its RFC1485 encoded equivalent.
** Returns a string that must be freed with PORT_Free().
*/
extern char *CERT_NameToAscii(CERTName *name);
extern CERTAVA *CERT_CopyAVA(PRArenaPool *arena, CERTAVA *src);
/* convert an OID to dotted-decimal representation */
/* Returns a string that must be freed with PR_smprintf_free(), */
/* Returns a string that must be freed with PR_smprintf_free(). */
extern char * CERT_GetOidString(const SECItem *oid);
/*
@ -923,7 +924,7 @@ extern CERTCrlDistributionPoints * CERT_FindCRLDistributionPoints
(CERTCertificate *cert);
/* Returns value of the keyUsage extension. This uses PR_Alloc to allocate
** buffer for the decoded value, The caller should free up the storage
** buffer for the decoded value. The caller should free up the storage
** allocated in value->data.
*/
extern SECStatus CERT_FindKeyUsageExtension (CERTCertificate *cert,