[openssl.org #251] PKCS12 memory leak?

2002-08-30 Thread Stephen Henson via RT


followup in openssl-users suggested the
cause was calliing:

sk_X509_free(Ca);

instead of

sk_X509_pop_free(Ca, X509_free);

__
OpenSSL Project http://www.openssl.org
Development Mailing List   [EMAIL PROTECTED]
Automated List Manager   [EMAIL PROTECTED]



[openssl.org #251] PKCS12 memory leak?

2002-08-26 Thread Shaheed Bacchus via RT


hi all,

i have a routine that reads a private key and cert from a bio
containing a PKCS12 file, the relevant part of the code is:

PK12 = d2i_PKCS12_bio(DataBio, NULL);
PKCS12_parse(PK12, Phrase, Pkey, Cert, Ca);
PKCS12_free(PK12);

at the end of the routine i free all of the structures used
and i also do
EVP_cleanup();

the memory leak tool on my system (proprietary
embedded system) reports that memory is being
leaked by routines that are called by PKCS12_parse()
some of the routines that it thinks are leaking include
ASN1_STRING_set, ASN1_STRING_type_new,
X509_CERT_AUX_new, etc (these are only a
few, there are several more all called directly or indirectly
by PKCS12_parse)

so my question is, is there some kind of cleanup routine
that i'm supposed to be running that will cleanup
the mess left behind?  thanks.

__
OpenSSL Project http://www.openssl.org
User Support Mailing List[EMAIL PROTECTED]
Automated List Manager   [EMAIL PROTECTED]
__
OpenSSL Project http://www.openssl.org
Development Mailing List   [EMAIL PROTECTED]
Automated List Manager   [EMAIL PROTECTED]



Re: [openssl.org #251] PKCS12 memory leak?

2002-08-26 Thread Dr. Stephen Henson

On Mon, Aug 26, 2002, Shaheed Bacchus via RT wrote:

 
 hi all,
 
 i have a routine that reads a private key and cert from a bio
 containing a PKCS12 file, the relevant part of the code is:
 
 PK12 = d2i_PKCS12_bio(DataBio, NULL);
 PKCS12_parse(PK12, Phrase, Pkey, Cert, Ca);
 PKCS12_free(PK12);
 
 at the end of the routine i free all of the structures used
 and i also do
 EVP_cleanup();
 
 the memory leak tool on my system (proprietary
 embedded system) reports that memory is being
 leaked by routines that are called by PKCS12_parse()
 some of the routines that it thinks are leaking include
 ASN1_STRING_set, ASN1_STRING_type_new,
 X509_CERT_AUX_new, etc (these are only a
 few, there are several more all called directly or indirectly
 by PKCS12_parse)
 
 so my question is, is there some kind of cleanup routine
 that i'm supposed to be running that will cleanup
 the mess left behind?  thanks.
 

That sounds like a certificate hasn't been freed up. Is there
a call to X509_new() as well? 

Steve.
--
Dr. Stephen Henson  [EMAIL PROTECTED]
OpenSSL Project http://www.openssl.org/~steve/
__
OpenSSL Project http://www.openssl.org
Development Mailing List   [EMAIL PROTECTED]
Automated List Manager   [EMAIL PROTECTED]