fix error found by coverity: check if ctx is != NULL before calling BN_CTX_end()
[oweals/openssl.git] / crypto / ec / ec2_smpl.c
index a9f7c9d378060d195e33127afd257d2ff3c44132..5cd1eac41fc33bb1bf435f4fc6d606870b0c8f85 100644 (file)
@@ -281,7 +281,8 @@ int ec_GF2m_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;