summaryrefslogtreecommitdiff
path: root/crypto/asn1/a_bytes.c
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2016-05-03 18:02:01 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2016-05-03 18:02:01 +0000
commit47b11f985b9e0ff561a67e19674de6fbcf79281d (patch)
treeda6c0490c1781cf42777777890fc53da00f780ed /crypto/asn1/a_bytes.c
parent8f9fae4c4537bd423d1a266b3280c396a2e90f44 (diff)
Diffstat (limited to 'crypto/asn1/a_bytes.c')
-rw-r--r--crypto/asn1/a_bytes.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/asn1/a_bytes.c b/crypto/asn1/a_bytes.c
index 12715a72809db..385b53986a299 100644
--- a/crypto/asn1/a_bytes.c
+++ b/crypto/asn1/a_bytes.c
@@ -200,13 +200,13 @@ ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp,
} else {
if (len != 0) {
if ((ret->length < len) || (ret->data == NULL)) {
- if (ret->data != NULL)
- OPENSSL_free(ret->data);
s = (unsigned char *)OPENSSL_malloc((int)len + 1);
if (s == NULL) {
i = ERR_R_MALLOC_FAILURE;
goto err;
}
+ if (ret->data != NULL)
+ OPENSSL_free(ret->data);
} else
s = ret->data;
memcpy(s, p, (int)len);