diff --git a/crypto/sm9/sm9_sign.c b/crypto/sm9/sm9_sign.c index a9466256..cd901ab1 100755 --- a/crypto/sm9/sm9_sign.c +++ b/crypto/sm9/sm9_sign.c @@ -198,6 +198,8 @@ end: BN_free(r); point_cleanup(&Ppubs); fp12_cleanup(w); + BN_CTX_end(bn_ctx); + BN_CTX_free(bn_ctx); return ret; } @@ -355,9 +357,7 @@ end: point_cleanup(&P); fp12_cleanup(w); fp12_cleanup(u); - if (bn_ctx) { - BN_CTX_end(bn_ctx); - } + BN_CTX_end(bn_ctx); BN_CTX_free(bn_ctx); return ret; }