diff options
author | deraadt <> | 2014-04-21 11:37:41 +0000 |
---|---|---|
committer | deraadt <> | 2014-04-21 11:37:41 +0000 |
commit | a13698710d1bf0bac4832733da5c86886601b5d4 (patch) | |
tree | ad42acc3896c553cb79781bc3a1ead69a74d55a3 /src/lib/libcrypto/asn1/f_int.c | |
parent | 6a6b6afb12953d4537a41790daa6abaad39258c5 (diff) | |
download | openbsd-a13698710d1bf0bac4832733da5c86886601b5d4.tar.gz openbsd-a13698710d1bf0bac4832733da5c86886601b5d4.tar.bz2 openbsd-a13698710d1bf0bac4832733da5c86886601b5d4.zip |
improve realloc/calloc/malloc patterns; ok guenther
Diffstat (limited to 'src/lib/libcrypto/asn1/f_int.c')
-rw-r--r-- | src/lib/libcrypto/asn1/f_int.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/lib/libcrypto/asn1/f_int.c b/src/lib/libcrypto/asn1/f_int.c index f355dbacbe..3f671d1c49 100644 --- a/src/lib/libcrypto/asn1/f_int.c +++ b/src/lib/libcrypto/asn1/f_int.c | |||
@@ -158,12 +158,7 @@ a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size) | |||
158 | } | 158 | } |
159 | i /= 2; | 159 | i /= 2; |
160 | if (num + i > slen) { | 160 | if (num + i > slen) { |
161 | if (s == NULL) | 161 | sp = OPENSSL_realloc_clean(s, slen, num + i * 2); |
162 | sp = (unsigned char *)malloc( | ||
163 | (unsigned int)num + i * 2); | ||
164 | else | ||
165 | sp = OPENSSL_realloc_clean(s, slen, | ||
166 | num + i * 2); | ||
167 | if (sp == NULL) { | 162 | if (sp == NULL) { |
168 | ASN1err(ASN1_F_A2I_ASN1_INTEGER, | 163 | ASN1err(ASN1_F_A2I_ASN1_INTEGER, |
169 | ERR_R_MALLOC_FAILURE); | 164 | ERR_R_MALLOC_FAILURE); |