diff options
author | Alessandro Ghedini <alessandro@ghedini.me> | 2015-10-08 14:38:57 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2015-10-23 19:58:54 +0200 |
commit | e90f1d9b74275c11e3492e521e46f4b1afa6f883 (patch) | |
tree | 2836966e5a5c05f9d2960ffd5efce899f50f5c58 /crypto/evp | |
parent | 5a1e6b1342f776f9304d9fa374149e317903b737 (diff) |
Fix memory leaks and other mistakes on errors
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 3f6c7691870d1cd2ad0e0c83638cef3f35a0b548)
Diffstat (limited to 'crypto/evp')
-rw-r--r-- | crypto/evp/evp_key.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/evp/evp_key.c b/crypto/evp/evp_key.c index 71fa627b20..122bc28df5 100644 --- a/crypto/evp/evp_key.c +++ b/crypto/evp/evp_key.c @@ -137,7 +137,7 @@ int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, EVP_MD_CTX_init(&c); for (;;) { if (!EVP_DigestInit_ex(&c, md, NULL)) - return 0; + goto err; if (addmd++) if (!EVP_DigestUpdate(&c, &(md_buf[0]), mds)) goto err; @@ -188,6 +188,6 @@ int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, rv = type->key_len; err: EVP_MD_CTX_cleanup(&c); - OPENSSL_cleanse(&(md_buf[0]), EVP_MAX_MD_SIZE); + OPENSSL_cleanse(md_buf, sizeof(md_buf)); return rv; } |