Make OPENSSL_NO_COMP compile again.
[oweals/openssl.git] / crypto / asn1 / a_type.c
index 96e111cf237b6b22cd031f0acde2d158b99a72db..a6acef16f3b3f27a5a51182ef289ced8796b562e 100644 (file)
  */
 
 #include <stdio.h>
-#include <openssl/asn1t.h>
 #include "cryptlib.h"
+#include <openssl/asn1t.h>
 
 int ASN1_TYPE_get(ASN1_TYPE *a)
        {
-       if (a->value.ptr != NULL)
+       if ((a->value.ptr != NULL) || (a->type == V_ASN1_NULL))
                return(a->type);
        else
                return(0);
@@ -71,7 +71,10 @@ int ASN1_TYPE_get(ASN1_TYPE *a)
 void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value)
        {
        if (a->value.ptr != NULL)
-               ASN1_primitive_free((ASN1_VALUE **)&a, NULL);
+               {
+               ASN1_TYPE **tmp_a = &a;
+               ASN1_primitive_free((ASN1_VALUE **)tmp_a, NULL);
+               }
        a->type=type;
        a->value.ptr=value;
        }