Some more prototype fixes.
[openssl.git] / crypto / asn1 / a_set.c
index 8cde8486894c3f83e6f095fff914c0b51f1a46ea..0f839822ff22f78fb8359ab83d87732b4d8add45 100644 (file)
@@ -60,6 +60,8 @@
 #include "cryptlib.h"
 #include <openssl/asn1_mac.h>
 
+#ifndef NO_ASN1_OLD
+
 typedef struct
     {
     unsigned char *pbData;
@@ -116,7 +118,7 @@ int i2d_ASN1_SET(STACK *a, unsigned char **pp, int (*func)(), int ex_tag,
                }
 
         pStart  = p; /* Catch the beg of Setblobs*/
-        rgSetBlob = (MYBLOB *)OPENSSL_malloc( sk_num(a) * sizeof(MYBLOB)); /* In this array
+        if (!(rgSetBlob = (MYBLOB *)OPENSSL_malloc( sk_num(a) * sizeof(MYBLOB)))) return 0; /* In this array
 we will store the SET blobs */
 
         for (i=0; i<sk_num(a); i++)
@@ -133,7 +135,7 @@ SetBlob
  /* Now we have to sort the blobs. I am using a simple algo.
     *Sort ptrs *Copy to temp-mem *Copy from temp-mem to user-mem*/
         qsort( rgSetBlob, sk_num(a), sizeof(MYBLOB), SetBlobCmp);
-        pTempMem = OPENSSL_malloc(totSize);
+        if (!(pTempMem = OPENSSL_malloc(totSize))) return 0;
 
 /* Copy to temp mem */
         p = pTempMem;
@@ -152,13 +154,13 @@ SetBlob
         }
 
 STACK *d2i_ASN1_SET(STACK **a, unsigned char **pp, long length,
-            char *(*func)(), void (*free_func)(), int ex_tag, int ex_class)
+            char *(*func)(), void (*free_func)(void *), int ex_tag, int ex_class)
        {
        ASN1_CTX c;
        STACK *ret=NULL;
 
        if ((a == NULL) || ((*a) == NULL))
-               { if ((ret=sk_new(NULL)) == NULL) goto err; }
+               { if ((ret=sk_new_null()) == NULL) goto err; }
        else
                ret=(*a);
 
@@ -215,3 +217,4 @@ err:
        return(NULL);
        }
 
+#endif