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:52:08 +0200 |
commit | 3f6c7691870d1cd2ad0e0c83638cef3f35a0b548 (patch) | |
tree | f0dae5a5fabb3b68e94d748ca49f4262411fad7a /crypto/evp/evp_key.c | |
parent | 8acaabec429b39f9436f6a88006384d72d292539 (diff) | |
download | openssl-3f6c7691870d1cd2ad0e0c83638cef3f35a0b548.tar.gz |
Fix memory leaks and other mistakes on errors
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/evp/evp_key.c')
-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 9c34a03441..5c03a91a94 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; } |