VMS: support VERBOSE and V in descrip.mms
[openssl.git] / crypto / asn1 / tasn_fre.c
index e219e2c0a31d3bfe85be16bf296b75c4a437ed3f..2fc036fb666f6ee831ca22cfbae4fde407117b92 100644 (file)
@@ -1,4 +1,3 @@
-/* tasn_fre.c */
 /*
  * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
  * 2000.
@@ -125,8 +124,10 @@ static void asn1_item_embed_free(ASN1_VALUE **pval, const ASN1_ITEM *it,
         }
         if (asn1_cb)
             asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);
-        OPENSSL_free(*pval);
-        *pval = NULL;
+        if (embed == 0) {
+            OPENSSL_free(*pval);
+            *pval = NULL;
+        }
         break;
 
     case ASN1_ITYPE_EXTERN:
@@ -249,6 +250,5 @@ void asn1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
         ASN1_STRING_free((ASN1_STRING *)*pval);
         break;
     }
-    if (*pval)
-        *pval = NULL;
+    *pval = NULL;
 }