fix error found by coverity: check if ctx is != NULL before calling BN_CTX_end()
[openssl.git] / crypto / ec / ecp_smpl.c
index 75296a36733089fb555ed2bc703a044863e4c58d..4d26f8bdf6921f4ae9a9e5be06fbde3f54b55628 100644 (file)
@@ -336,7 +336,8 @@ int ec_GFp_simple_group_check_discriminant(const EC_GROUP *group, BN_CTX *ctx)
        ret = 1;
 
 err:
-       BN_CTX_end(ctx);
+       if (ctx != NULL)
+               BN_CTX_end(ctx);
        if (new_ctx != NULL)
                BN_CTX_free(new_ctx);
        return ret;