diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2001-01-24 18:39:54 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2001-01-24 18:39:54 +0000 |
commit | a43cf9fae96175ee91da08aa523c508c3d3e6dde (patch) | |
tree | 5d17c0c155d2ad589b6dda1bf6bb32812d8d7ec6 /crypto/asn1 | |
parent | 9ae9c221de0cc6c8204290d9c7a6f633001af753 (diff) | |
download | openssl-a43cf9fae96175ee91da08aa523c508c3d3e6dde.tar.gz |
Add debugging info to new ASN1 code to trace memory leaks.
Fix PKCS7 and PKCS12 memory leaks.
Initialise encapsulated content type properly.
Diffstat (limited to 'crypto/asn1')
-rw-r--r-- | crypto/asn1/tasn_new.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/crypto/asn1/tasn_new.c b/crypto/asn1/tasn_new.c index d6f1155928..da0cb266e4 100644 --- a/crypto/asn1/tasn_new.c +++ b/crypto/asn1/tasn_new.c @@ -96,6 +96,10 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int if(!combine) *pval = NULL; +#ifdef CRYPTO_MDEBUG + if(it->sname) CRYPTO_push_info(it->sname); +#endif + switch(it->itype) { case ASN1_ITYPE_EXTERN: @@ -166,15 +170,24 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int goto auxerr; break; } +#ifdef CRYPTO_MDEBUG + if(it->sname) CRYPTO_pop_info(); +#endif return 1; memerr: ASN1err(ASN1_F_ASN1_ITEM_NEW, ERR_R_MALLOC_FAILURE); +#ifdef CRYPTO_MDEBUG + if(it->sname) CRYPTO_pop_info(); +#endif return 0; auxerr: ASN1err(ASN1_F_ASN1_ITEM_NEW, ASN1_R_AUX_ERROR); ASN1_item_ex_free(pval, it); +#ifdef CRYPTO_MDEBUG + if(it->sname) CRYPTO_pop_info(); +#endif return 0; } @@ -216,6 +229,7 @@ static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it) int ASN1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt) { const ASN1_ITEM *it = tt->item; + int ret; if(tt->flags & ASN1_TFLG_OPTIONAL) { asn1_template_clear(pval, tt); return 1; @@ -226,19 +240,29 @@ int ASN1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt) *pval = NULL; return 1; } +#ifdef CRYPTO_MDEBUG + if(tt->field_name) CRYPTO_push_info(tt->field_name); +#endif /* If SET OF or SEQUENCE OF, its a STACK */ if(tt->flags & ASN1_TFLG_SK_MASK) { STACK_OF(ASN1_VALUE) *skval; skval = sk_ASN1_VALUE_new_null(); if(!skval) { ASN1err(ASN1_F_ASN1_TEMPLATE_NEW, ERR_R_MALLOC_FAILURE); - return 0; + ret = 0; + goto done; } *pval = (ASN1_VALUE *)skval; - return 1; + ret = 1; + goto done; } /* Otherwise pass it back to the item routine */ - return asn1_item_ex_combine_new(pval, it, tt->flags & ASN1_TFLG_COMBINE); + ret = asn1_item_ex_combine_new(pval, it, tt->flags & ASN1_TFLG_COMBINE); + done: +#ifdef CRYPTO_MDEBUG + if(it->sname) CRYPTO_pop_info(); +#endif + return ret; } void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt) |