diff options
Diffstat (limited to 'src/lib/libcrypto/asn1/a_bytes.c')
| -rw-r--r-- | src/lib/libcrypto/asn1/a_bytes.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/lib/libcrypto/asn1/a_bytes.c b/src/lib/libcrypto/asn1/a_bytes.c index 6cc774e782..0d26e46681 100644 --- a/src/lib/libcrypto/asn1/a_bytes.c +++ b/src/lib/libcrypto/asn1/a_bytes.c | |||
| @@ -110,8 +110,7 @@ d2i_ASN1_type_bytes(ASN1_STRING **a, const unsigned char **pp, | |||
| 110 | } else | 110 | } else |
| 111 | s = NULL; | 111 | s = NULL; |
| 112 | 112 | ||
| 113 | if (ret->data != NULL) | 113 | free(ret->data); |
| 114 | free(ret->data); | ||
| 115 | ret->length = (int)len; | 114 | ret->length = (int)len; |
| 116 | ret->data = s; | 115 | ret->data = s; |
| 117 | ret->type = tag; | 116 | ret->type = tag; |
| @@ -203,8 +202,7 @@ d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp, | |||
| 203 | } else { | 202 | } else { |
| 204 | if (len != 0) { | 203 | if (len != 0) { |
| 205 | if ((ret->length < len) || (ret->data == NULL)) { | 204 | if ((ret->length < len) || (ret->data == NULL)) { |
| 206 | if (ret->data != NULL) | 205 | free(ret->data); |
| 207 | free(ret->data); | ||
| 208 | ret->data = NULL; | 206 | ret->data = NULL; |
| 209 | s = malloc(len + 1); | 207 | s = malloc(len + 1); |
| 210 | if (s == NULL) { | 208 | if (s == NULL) { |
| @@ -218,8 +216,7 @@ d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp, | |||
| 218 | p += len; | 216 | p += len; |
| 219 | } else { | 217 | } else { |
| 220 | s = NULL; | 218 | s = NULL; |
| 221 | if (ret->data != NULL) | 219 | free(ret->data); |
| 222 | free(ret->data); | ||
| 223 | } | 220 | } |
| 224 | 221 | ||
| 225 | ret->length = (int)len; | 222 | ret->length = (int)len; |
| @@ -293,8 +290,7 @@ asn1_collate_primitive(ASN1_STRING *a, ASN1_const_CTX *c) | |||
| 293 | goto err; | 290 | goto err; |
| 294 | 291 | ||
| 295 | a->length = num; | 292 | a->length = num; |
| 296 | if (a->data != NULL) | 293 | free(a->data); |
| 297 | free(a->data); | ||
| 298 | a->data = (unsigned char *)b.data; | 294 | a->data = (unsigned char *)b.data; |
| 299 | if (os != NULL) | 295 | if (os != NULL) |
| 300 | ASN1_STRING_free(os); | 296 | ASN1_STRING_free(os); |
| @@ -304,7 +300,6 @@ err: | |||
| 304 | ASN1err(ASN1_F_ASN1_COLLATE_PRIMITIVE, c->error); | 300 | ASN1err(ASN1_F_ASN1_COLLATE_PRIMITIVE, c->error); |
| 305 | if (os != NULL) | 301 | if (os != NULL) |
| 306 | ASN1_STRING_free(os); | 302 | ASN1_STRING_free(os); |
| 307 | if (b.data != NULL) | 303 | free(b.data); |
| 308 | free(b.data); | ||
| 309 | return (0); | 304 | return (0); |
| 310 | } | 305 | } |
