diff options
author | Rich Salz <rsalz@openssl.org> | 2015-03-25 18:35:24 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2015-03-25 18:35:24 -0400 |
commit | 8fdc3734c063146b038608c2412a0f2c9b21b6d6 (patch) | |
tree | ed30d40a40a6bf7002121a29e3db4b4790a54d87 /crypto/ec/ec_pmeth.c | |
parent | 17dd65e6e1f888b4561d559b4d44fbbe0a0aa3e7 (diff) | |
download | openssl-8fdc3734c063146b038608c2412a0f2c9b21b6d6.tar.gz |
free NULL cleanup.
This gets EC_GROUP_clear_free EC_GROUP_free, EC_KEY_free,
EC_POINT_clear_free, EC_POINT_free
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Diffstat (limited to 'crypto/ec/ec_pmeth.c')
-rw-r--r-- | crypto/ec/ec_pmeth.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/crypto/ec/ec_pmeth.c b/crypto/ec/ec_pmeth.c index 4eda2effe9..37f8fa1316 100644 --- a/crypto/ec/ec_pmeth.c +++ b/crypto/ec/ec_pmeth.c @@ -146,10 +146,8 @@ static void pkey_ec_cleanup(EVP_PKEY_CTX *ctx) { EC_PKEY_CTX *dctx = ctx->data; if (dctx) { - if (dctx->gen_group) - EC_GROUP_free(dctx->gen_group); - if (dctx->co_key) - EC_KEY_free(dctx->co_key); + EC_GROUP_free(dctx->gen_group); + EC_KEY_free(dctx->co_key); if (dctx->kdf_ukm) OPENSSL_free(dctx->kdf_ukm); OPENSSL_free(dctx); @@ -289,8 +287,7 @@ static int pkey_ec_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) ECerr(EC_F_PKEY_EC_CTRL, EC_R_INVALID_CURVE); return 0; } - if (dctx->gen_group) - EC_GROUP_free(dctx->gen_group); + EC_GROUP_free(dctx->gen_group); dctx->gen_group = group; return 1; @@ -331,7 +328,7 @@ static int pkey_ec_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) EC_KEY_set_flags(dctx->co_key, EC_FLAG_COFACTOR_ECDH); else EC_KEY_clear_flags(dctx->co_key, EC_FLAG_COFACTOR_ECDH); - } else if (dctx->co_key) { + } else { EC_KEY_free(dctx->co_key); dctx->co_key = NULL; } |