diff options
author | 2014-04-21 11:37:41 +0000 | |
---|---|---|
committer | 2014-04-21 11:37:41 +0000 | |
commit | 6dae11f4ef996ad1ad3f526b8099c5f4d1e3f5a2 (patch) | |
tree | 26fbaa6b0969f88dc2c446302af9d8659bca8037 /lib/libcrypto/asn1/a_bitstr.c | |
parent | Use internal '__' names for __attributes__ in public headers (diff) | |
download | wireguard-openbsd-6dae11f4ef996ad1ad3f526b8099c5f4d1e3f5a2.tar.xz wireguard-openbsd-6dae11f4ef996ad1ad3f526b8099c5f4d1e3f5a2.zip |
improve realloc/calloc/malloc patterns; ok guenther
Diffstat (limited to 'lib/libcrypto/asn1/a_bitstr.c')
-rw-r--r-- | lib/libcrypto/asn1/a_bitstr.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/libcrypto/asn1/a_bitstr.c b/lib/libcrypto/asn1/a_bitstr.c index c578ce6279f..f3cce8b5366 100644 --- a/lib/libcrypto/asn1/a_bitstr.c +++ b/lib/libcrypto/asn1/a_bitstr.c @@ -153,7 +153,7 @@ c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, const unsigned char **pp, long len) if (len-- > 1) /* using one because of the bits left byte */ { - s = (unsigned char *)malloc((int)len); + s = malloc((int)len); if (s == NULL) { i = ERR_R_MALLOC_FAILURE; goto err; @@ -203,11 +203,7 @@ ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value) if ((a->length < (w + 1)) || (a->data == NULL)) { if (!value) return(1); /* Don't need to set */ - if (a->data == NULL) - c = (unsigned char *)malloc(w + 1); - else - c = (unsigned char *)OPENSSL_realloc_clean(a->data, - a->length, w + 1); + c = OPENSSL_realloc_clean(a->data, a->length, w + 1); if (c == NULL) { ASN1err(ASN1_F_ASN1_BIT_STRING_SET_BIT, ERR_R_MALLOC_FAILURE); return 0; |