diff --git a/security/nss/lib/softoken/pcertdb.c b/security/nss/lib/softoken/pcertdb.c index f380c735d743..ebc05955e70a 100644 --- a/security/nss/lib/softoken/pcertdb.c +++ b/security/nss/lib/softoken/pcertdb.c @@ -37,7 +37,7 @@ /* * Permanent Certificate database handling code * - * $Id: pcertdb.c,v 1.49 2005/03/29 18:21:18 nelsonb%netscape.com Exp $ + * $Id: pcertdb.c,v 1.50 2005/08/01 20:41:30 relyea%netscape.com Exp $ */ #include "prtime.h" @@ -388,17 +388,25 @@ pkcs11_freeStaticData (unsigned char *data, unsigned char *space) } } +unsigned char * +pkcs11_allocStaticData(int len, unsigned char *space, int spaceLen) +{ + unsigned char *data = NULL; + + if (len <= spaceLen) { + data = space; + } else { + data = (unsigned char *) PORT_Alloc(len); + } + + return data; +} + unsigned char * pkcs11_copyStaticData(unsigned char *data, int len, unsigned char *space, int spaceLen) { - unsigned char *copy = NULL; - - if (len <= spaceLen) { - copy = space; - } else { - copy = (unsigned char *) PORT_Alloc(len); - } + unsigned char *copy = pkcs11_allocStaticData(len, space, spaceLen); if (copy) { PORT_Memcpy(copy,data,len); }