summaryrefslogtreecommitdiff
path: root/apps/enc.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2021-02-17 16:15:27 -0500
committerDmitry Belyavskiy <beldmit@gmail.com>2021-04-20 10:12:29 +0200
commit606a417fb2b6ce5d1d112f2f3f710c8085744627 (patch)
tree332af9e08a75b5f628f6786300d6ee43a816e964 /apps/enc.c
parentc39352e4e4952a9f4b2171134af0e015a4d40768 (diff)
downloadopenssl-new-606a417fb2b6ce5d1d112f2f3f710c8085744627.tar.gz
Fetch and free cipher and md's
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/14219)
Diffstat (limited to 'apps/enc.c')
-rw-r--r--apps/enc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/apps/enc.c b/apps/enc.c
index 3647a1ce61..242d3ef0aa 100644
--- a/apps/enc.c
+++ b/apps/enc.c
@@ -109,8 +109,8 @@ int enc_main(int argc, char **argv)
BIO *in = NULL, *out = NULL, *b64 = NULL, *benc = NULL, *rbio =
NULL, *wbio = NULL;
EVP_CIPHER_CTX *ctx = NULL;
- const EVP_CIPHER *cipher = NULL;
- const EVP_MD *dgst = NULL;
+ EVP_CIPHER *cipher = NULL;
+ EVP_MD *dgst = NULL;
const char *digestname = NULL;
char *hkey = NULL, *hiv = NULL, *hsalt = NULL, *p;
char *infile = NULL, *outfile = NULL, *prog;
@@ -314,7 +314,7 @@ int enc_main(int argc, char **argv)
goto opthelp;
}
if (dgst == NULL)
- dgst = EVP_sha256();
+ dgst = (EVP_MD *)EVP_sha256();
if (iter == 0)
iter = 1;
@@ -633,6 +633,8 @@ int enc_main(int argc, char **argv)
BIO_free_all(out);
BIO_free(benc);
BIO_free(b64);
+ EVP_MD_free(dgst);
+ EVP_CIPHER_free(cipher);
#ifdef ZLIB
BIO_free(bzl);
#endif