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>
diff --git a/crypto/dsa/dsa_lib.c b/crypto/dsa/dsa_lib.c
index 26a5d28..9f4ddfd 100644
--- a/crypto/dsa/dsa_lib.c
+++ b/crypto/dsa/dsa_lib.c
@@ -99,10 +99,8 @@
if (mtmp->finish)
mtmp->finish(dsa);
#ifndef OPENSSL_NO_ENGINE
- if (dsa->engine) {
- ENGINE_finish(dsa->engine);
- dsa->engine = NULL;
- }
+ ENGINE_finish(dsa->engine);
+ dsa->engine = NULL;
#endif
dsa->meth = meth;
if (meth->init)
@@ -132,7 +130,7 @@
ret->engine = ENGINE_get_default_DSA();
if (ret->engine) {
ret->meth = ENGINE_get_DSA(ret->engine);
- if (!ret->meth) {
+ if (ret->meth == NULL) {
DSAerr(DSA_F_DSA_NEW_METHOD, ERR_R_ENGINE_LIB);
ENGINE_finish(ret->engine);
OPENSSL_free(ret);