Fix double free in d2i_PrivateKey().
[openssl.git] / crypto / asn1 / a_type.c
index 864ebec0f9ca71a7388d1cce14278a2b63c5dc8f..e132b0c40afeb6061e62a15ba7fa26e05f16937d 100644 (file)
@@ -1,4 +1,3 @@
-/* crypto/asn1/a_type.c */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -57,7 +56,7 @@
  */
 
 #include <stdio.h>
-#include "cryptlib.h"
+#include "internal/cryptlib.h"
 #include <openssl/asn1t.h>
 #include <openssl/objects.h>
 #include "asn1_locl.h"
@@ -123,9 +122,7 @@ int ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b)
         result = 0;             /* They do not have content. */
         break;
     case V_ASN1_INTEGER:
-    case V_ASN1_NEG_INTEGER:
     case V_ASN1_ENUMERATED:
-    case V_ASN1_NEG_ENUMERATED:
     case V_ASN1_BIT_STRING:
     case V_ASN1_OCTET_STRING:
     case V_ASN1_SEQUENCE:
@@ -179,7 +176,7 @@ ASN1_TYPE *ASN1_TYPE_pack_sequence(const ASN1_ITEM *it, void *s, ASN1_TYPE **t)
 
 void *ASN1_TYPE_unpack_sequence(const ASN1_ITEM *it, const ASN1_TYPE *t)
 {
-    if (t->type != V_ASN1_SEQUENCE || t->value.sequence == NULL)
+    if (t == NULL || t->type != V_ASN1_SEQUENCE || t->value.sequence == NULL)
         return NULL;
     return ASN1_item_unpack(t->value.sequence, it);
 }