summaryrefslogtreecommitdiffstats
path: root/crypto/evp/pmeth_lib.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2016-02-25 12:09:06 -0500
committerRich Salz <rsalz@openssl.org>2016-02-25 15:19:42 -0500
commit7c96dbcdab959fef74c4caae63cdebaa354ab252 (patch)
treeaf59789bb5bc85efd7e700d657db004910f8ba64 /crypto/evp/pmeth_lib.c
parent07b3ce8f8029f647c1babf0d8a03599885e7e284 (diff)
GH715: ENGINE_finish can take NULL
Simplifies calling code. Also fixed up any !ptr tests that were nearby, turning them into NULL tests. Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/evp/pmeth_lib.c')
-rw-r--r--crypto/evp/pmeth_lib.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c
index 5b2301431a..72baaa988d 100644
--- a/crypto/evp/pmeth_lib.c
+++ b/crypto/evp/pmeth_lib.c
@@ -162,8 +162,7 @@ static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id)
ret = OPENSSL_zalloc(sizeof(*ret));
if (ret == NULL) {
#ifndef OPENSSL_NO_ENGINE
- if (e)
- ENGINE_finish(e);
+ ENGINE_finish(e);
#endif
EVPerr(EVP_F_INT_CTX_NEW, ERR_R_MALLOC_FAILURE);
return NULL;
@@ -329,12 +328,7 @@ void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx)
EVP_PKEY_free(ctx->pkey);
EVP_PKEY_free(ctx->peerkey);
#ifndef OPENSSL_NO_ENGINE
- if (ctx->engine)
- /*
- * The EVP_PKEY_CTX we used belongs to an ENGINE, release the
- * functional reference we held for this reason.
- */
- ENGINE_finish(ctx->engine);
+ ENGINE_finish(ctx->engine);
#endif
OPENSSL_free(ctx);
}