set engine to NULL after releasing it
[openssl.git] / crypto / evp / p_lib.c
index 249ac2bd2a08e1d7fcbc7681ea85b8ae579e4005..1916c616991f9f36fcf6e2f366cc01ae0934690c 100644 (file)
@@ -220,7 +220,10 @@ static int pkey_set_type(EVP_PKEY *pkey, int type, const char *str, int len)
 #ifndef OPENSSL_NO_ENGINE
                /* If we have an ENGINE release it */
                if (pkey->engine)
+                       {
                        ENGINE_finish(pkey->engine);
+                       pkey->engine = NULL;
+                       }
 #endif
                }
        if (str)