summaryrefslogtreecommitdiffstats
path: root/crypto/asn1/a_digest.c
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2016-12-31 13:01:11 +0100
committerRichard Levitte <levitte@openssl.org>2017-02-05 00:58:00 +0100
commit5d0634a93bdc18e753d641c4563cb18f685e148f (patch)
tree3e37a7584a5f9552848147f45dd31a5dec24bd32 /crypto/asn1/a_digest.c
parentac162301b45a7458ced227437922141c692383ae (diff)
Combined patch against OpenSSL_1_1_0-stable branch for the following issues:
Fixed a memory leak in ASN1_digest and ASN1_item_digest. Reworked error handling in asn1_item_embed_new. Fixed error handling in int_ctx_new and EVP_PKEY_CTX_dup. Fixed a memory leak in CRYPTO_free_ex_data. Reworked error handing in x509_name_ex_d2i, x509_name_encode and x509_name_canon. Check for null pointer in tls_process_cert_verify. Fixes #2103 #2104 #2105 #2109 #2111 #2115 Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2163)
Diffstat (limited to 'crypto/asn1/a_digest.c')
-rw-r--r--crypto/asn1/a_digest.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/crypto/asn1/a_digest.c b/crypto/asn1/a_digest.c
index 2f9b63b2a1..46bff0d88f 100644
--- a/crypto/asn1/a_digest.c
+++ b/crypto/asn1/a_digest.c
@@ -37,8 +37,10 @@ int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data,
p = str;
i2d(data, &p);
- if (!EVP_Digest(str, i, md, len, type, NULL))
+ if (!EVP_Digest(str, i, md, len, type, NULL)) {
+ OPENSSL_free(str);
return 0;
+ }
OPENSSL_free(str);
return (1);
}
@@ -55,8 +57,10 @@ int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *asn,
if (!str)
return (0);
- if (!EVP_Digest(str, i, md, len, type, NULL))
+ if (!EVP_Digest(str, i, md, len, type, NULL)) {
+ OPENSSL_free(str);
return 0;
+ }
OPENSSL_free(str);
return (1);
}