summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2021-03-29 12:37:43 +1000
committerTomas Mraz <tomas@openssl.org>2021-03-30 18:57:30 +0200
commitd1a57d873b0e8a09370010f5f632c3f10c7cf9fc (patch)
tree613fd916c41eab70f85652c3ce8ffeea7fb80d3e /apps
parent92b3e62fdd5c85101998affe2260ac845cf09ba4 (diff)
apps: fix coverity 1474463, 1474465 & 1474467: resource leaks
Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14716)
Diffstat (limited to 'apps')
-rw-r--r--apps/speed.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/apps/speed.c b/apps/speed.c
index 0bd566e846..727341a1e6 100644
--- a/apps/speed.c
+++ b/apps/speed.c
@@ -3603,8 +3603,8 @@ static void multiblock_speed(const EVP_CIPHER *evp_cipher, int lengths_single,
const int *mblengths = mblengths_list;
int j, count, keylen, num = OSSL_NELEM(mblengths_list);
const char *alg_name;
- unsigned char *inp, *out, *key, no_key[32], no_iv[16];
- EVP_CIPHER_CTX *ctx;
+ unsigned char *inp = NULL, *out = NULL, *key, no_key[32], no_iv[16];
+ EVP_CIPHER_CTX *ctx = NULL;
double d = 0.0;
if (lengths_single) {
@@ -3621,7 +3621,7 @@ static void multiblock_speed(const EVP_CIPHER *evp_cipher, int lengths_single,
if ((keylen = EVP_CIPHER_CTX_key_length(ctx)) < 0) {
BIO_printf(bio_err, "Impossible negative key length: %d\n", keylen);
- return;
+ goto err;
}
key = app_malloc(keylen, "evp_cipher key");
if (!EVP_CIPHER_CTX_rand_key(ctx, key))
@@ -3710,6 +3710,7 @@ static void multiblock_speed(const EVP_CIPHER *evp_cipher, int lengths_single,
fprintf(stdout, "\n");
}
+ err:
OPENSSL_free(inp);
OPENSSL_free(out);
EVP_CIPHER_CTX_free(ctx);