make update
[openssl.git] / crypto / asn1 / tasn_new.c
index da0cb266e4abca777fe8c3aae528fec068890d81..e93db4f0c1490d8846966ae91beb189960661e58 100644 (file)
@@ -62,6 +62,7 @@
 #include <openssl/objects.h>
 #include <openssl/err.h>
 #include <openssl/asn1t.h>
+#include <string.h>
 
 static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int combine);
 static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
@@ -137,7 +138,12 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int
                if(asn1_cb) {
                        i = asn1_cb(ASN1_OP_NEW_PRE, pval, it);
                        if(!i) goto auxerr;
-                       if(i==2) return 1;
+                       if(i==2) {
+#ifdef CRYPTO_MDEBUG
+                               if(it->sname) CRYPTO_pop_info();
+#endif
+                               return 1;
+                       }
                }
                if(!combine) {
                        *pval = OPENSSL_malloc(it->size);
@@ -153,7 +159,12 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int
                if(asn1_cb) {
                        i = asn1_cb(ASN1_OP_NEW_PRE, pval, it);
                        if(!i) goto auxerr;
-                       if(i==2) return 1;
+                       if(i==2) {
+#ifdef CRYPTO_MDEBUG
+                               if(it->sname) CRYPTO_pop_info();
+#endif
+                               return 1;
+                       }
                }
                if(!combine) {
                        *pval = OPENSSL_malloc(it->size);
@@ -228,7 +239,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;
+       const ASN1_ITEM *it = ASN1_ITEM_ptr(tt->item);
        int ret;
        if(tt->flags & ASN1_TFLG_OPTIONAL) {
                asn1_template_clear(pval, tt);
@@ -271,7 +282,7 @@ void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
        if(tt->flags & (ASN1_TFLG_ADB_MASK|ASN1_TFLG_SK_MASK)) 
                *pval = NULL;
        else
-               asn1_item_clear(pval, tt->item);
+               asn1_item_clear(pval, ASN1_ITEM_ptr(tt->item));
 }