Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2016-05-03 14:38:54 +0300
committerAdam Langley <agl@google.com>2016-05-03 19:36:04 +0300
commiteb3257211e3bd7dbdbe636144b6838dd20c37ef3 (patch)
tree26aee515202741bc65f77be42399a3ab5754f39f /crypto/asn1
parent52a3bf2835200a7beabe349a85cb2355e42ab599 (diff)
Don't free ret->data if malloc fails.
Issue reported by Guido Vranken. (Imported from upstream's 64eaf6c928f4066d62aa86f805796ef05bd0b1cc.) Change-Id: I99793abb4e1b5da5b70468b207ec03013fff674a Reviewed-on: https://boringssl-review.googlesource.com/7843 Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/asn1')
-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 7e2f85dc..e6b2f2e9 100644
--- a/crypto/asn1/a_bytes.c
+++ b/crypto/asn1/a_bytes.c
@@ -202,13 +202,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);