summaryrefslogtreecommitdiffstats
path: root/crypto/pkcs7/pk7_asn1.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2001-01-24 18:39:54 +0000
committerDr. Stephen Henson <steve@openssl.org>2001-01-24 18:39:54 +0000
commita43cf9fae96175ee91da08aa523c508c3d3e6dde (patch)
tree5d17c0c155d2ad589b6dda1bf6bb32812d8d7ec6 /crypto/pkcs7/pk7_asn1.c
parent9ae9c221de0cc6c8204290d9c7a6f633001af753 (diff)
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/pkcs7/pk7_asn1.c')
-rw-r--r--crypto/pkcs7/pk7_asn1.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/crypto/pkcs7/pk7_asn1.c b/crypto/pkcs7/pk7_asn1.c
index 9c5eda2b36..34561dfc51 100644
--- a/crypto/pkcs7/pk7_asn1.c
+++ b/crypto/pkcs7/pk7_asn1.c
@@ -136,12 +136,22 @@ ASN1_SEQUENCE(PKCS7_ENVELOPE) = {
IMPLEMENT_ASN1_FUNCTIONS(PKCS7_ENVELOPE)
-ASN1_SEQUENCE(PKCS7_RECIP_INFO) = {
+/* Minor tweak to operation: free up X509 */
+static int ri_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
+{
+ if(operation == ASN1_OP_FREE_POST) {
+ PKCS7_RECIP_INFO *ri = (PKCS7_RECIP_INFO *)*pval;
+ X509_free(ri->cert);
+ }
+ return 1;
+}
+
+ASN1_SEQUENCE_cb(PKCS7_RECIP_INFO, ri_cb) = {
ASN1_SIMPLE(PKCS7_RECIP_INFO, version, ASN1_INTEGER),
ASN1_SIMPLE(PKCS7_RECIP_INFO, issuer_and_serial, PKCS7_ISSUER_AND_SERIAL),
ASN1_SIMPLE(PKCS7_RECIP_INFO, key_enc_algor, X509_ALGOR),
ASN1_SIMPLE(PKCS7_RECIP_INFO, enc_key, ASN1_OCTET_STRING)
-} ASN1_SEQUENCE_END(PKCS7_RECIP_INFO);
+} ASN1_SEQUENCE_END_cb(PKCS7_RECIP_INFO, PKCS7_RECIP_INFO);
IMPLEMENT_ASN1_FUNCTIONS(PKCS7_RECIP_INFO)