diff options
author | Alessandro Ghedini <alessandro@ghedini.me> | 2015-10-08 14:38:57 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2015-10-23 19:52:08 +0200 |
commit | 3f6c7691870d1cd2ad0e0c83638cef3f35a0b548 (patch) | |
tree | f0dae5a5fabb3b68e94d748ca49f4262411fad7a /crypto/bn/bn_recp.c | |
parent | 8acaabec429b39f9436f6a88006384d72d292539 (diff) |
Fix memory leaks and other mistakes on errors
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/bn/bn_recp.c')
-rw-r--r-- | crypto/bn/bn_recp.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/bn/bn_recp.c b/crypto/bn/bn_recp.c index 3dc2166c7d..39eed8b297 100644 --- a/crypto/bn/bn_recp.c +++ b/crypto/bn/bn_recp.c @@ -151,8 +151,10 @@ int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, if (BN_ucmp(m, &(recp->N)) < 0) { BN_zero(d); - if (!BN_copy(r, m)) + if (!BN_copy(r, m)) { + BN_CTX_end(ctx); return 0; + } BN_CTX_end(ctx); return (1); } |