Prepare for 0.9.8ze-dev
[oweals/openssl.git] / crypto / asn1 / tasn_enc.c
index 25c94aa1d95a078c3db63a94ad793cc040d0b128..b3687f9f1c5177d2fe80143a1ae4d5a434fd2b00 100644 (file)
@@ -1,5 +1,5 @@
 /* tasn_enc.c */
-/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
+/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
  * project 2000.
  */
 /* ====================================================================
@@ -453,9 +453,14 @@ static int asn1_set_seq_out(STACK_OF(ASN1_VALUE) *sk, unsigned char **out,
                        {
                        derlst = OPENSSL_malloc(sk_ASN1_VALUE_num(sk)
                                                * sizeof(*derlst));
+                       if (!derlst)
+                               return 0;
                        tmpdat = OPENSSL_malloc(skcontlen);
-                       if (!derlst || !tmpdat)
+                       if (!tmpdat)
+                               {
+                               OPENSSL_free(derlst);
                                return 0;
+                               }
                        }
                }
        /* If not sorting just output each item */
@@ -494,7 +499,7 @@ static int asn1_set_seq_out(STACK_OF(ASN1_VALUE) *sk, unsigned char **out,
                {
                for (i = 0, tder = derlst; i < sk_ASN1_VALUE_num(sk);
                                                        i++, tder++)
-                       sk_ASN1_VALUE_set(sk, i, tder->field);
+                       (void)sk_ASN1_VALUE_set(sk, i, tder->field);
                }
        OPENSSL_free(derlst);
        OPENSSL_free(tmpdat);
@@ -597,7 +602,7 @@ int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cout, int *putype,
                typ = (ASN1_TYPE *)*pval;
                utype = typ->type;
                *putype = utype;
-               pval = (ASN1_VALUE **)&typ->value.ptr;
+               pval = &typ->value.asn1_value;
                }
        else utype = *putype;