summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/a_set.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1/a_set.c')
-rw-r--r--src/lib/libcrypto/asn1/a_set.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/src/lib/libcrypto/asn1/a_set.c b/src/lib/libcrypto/asn1/a_set.c
index e24061c545..0f839822ff 100644
--- a/src/lib/libcrypto/asn1/a_set.c
+++ b/src/lib/libcrypto/asn1/a_set.c
@@ -118,13 +118,8 @@ int i2d_ASN1_SET(STACK *a, unsigned char **pp, int (*func)(), int ex_tag,
118 } 118 }
119 119
120 pStart = p; /* Catch the beg of Setblobs*/ 120 pStart = p; /* Catch the beg of Setblobs*/
121 /* In this array we will store the SET blobs */ 121 if (!(rgSetBlob = (MYBLOB *)OPENSSL_malloc( sk_num(a) * sizeof(MYBLOB)))) return 0; /* In this array
122 rgSetBlob = (MYBLOB *)OPENSSL_malloc(sk_num(a) * sizeof(MYBLOB)); 122we will store the SET blobs */
123 if (rgSetBlob == NULL)
124 {
125 ASN1err(ASN1_F_I2D_ASN1_SET,ERR_R_MALLOC_FAILURE);
126 return(0);
127 }
128 123
129 for (i=0; i<sk_num(a); i++) 124 for (i=0; i<sk_num(a); i++)
130 { 125 {
@@ -140,11 +135,7 @@ SetBlob
140 /* Now we have to sort the blobs. I am using a simple algo. 135 /* Now we have to sort the blobs. I am using a simple algo.
141 *Sort ptrs *Copy to temp-mem *Copy from temp-mem to user-mem*/ 136 *Sort ptrs *Copy to temp-mem *Copy from temp-mem to user-mem*/
142 qsort( rgSetBlob, sk_num(a), sizeof(MYBLOB), SetBlobCmp); 137 qsort( rgSetBlob, sk_num(a), sizeof(MYBLOB), SetBlobCmp);
143 if (!(pTempMem = OPENSSL_malloc(totSize))) 138 if (!(pTempMem = OPENSSL_malloc(totSize))) return 0;
144 {
145 ASN1err(ASN1_F_I2D_ASN1_SET,ERR_R_MALLOC_FAILURE);
146 return(0);
147 }
148 139
149/* Copy to temp mem */ 140/* Copy to temp mem */
150 p = pTempMem; 141 p = pTempMem;
@@ -169,13 +160,7 @@ STACK *d2i_ASN1_SET(STACK **a, unsigned char **pp, long length,
169 STACK *ret=NULL; 160 STACK *ret=NULL;
170 161
171 if ((a == NULL) || ((*a) == NULL)) 162 if ((a == NULL) || ((*a) == NULL))
172 { 163 { if ((ret=sk_new_null()) == NULL) goto err; }
173 if ((ret=sk_new_null()) == NULL)
174 {
175 ASN1err(ASN1_F_D2I_ASN1_SET,ERR_R_MALLOC_FAILURE);
176 goto err;
177 }
178 }
179 else 164 else
180 ret=(*a); 165 ret=(*a);
181 166