summaryrefslogtreecommitdiffstats
path: root/crypto/bn
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2015-03-11 15:31:16 +0000
committerMatt Caswell <matt@openssl.org>2015-03-12 09:29:48 +0000
commit8944d10e2d444b7fc5e60d4f13644c6648f49e74 (patch)
treeac96a4f44858642b7bb041c89681ad52182dca73 /crypto/bn
parentdf57e42baa0c1c8a97035adb9ffb2f335158c440 (diff)
Fix error handling in bn_exp
In the event of an error |rr| could be NULL. Therefore don't assume you can use |rr| in the error handling code. Reviewed-by: Andy Polyakov <appro@openssl.org> (cherry picked from commit 8c5a7b33c6269c3bd6bc0df6b4c22e4fba03b485)
Diffstat (limited to 'crypto/bn')
-rw-r--r--crypto/bn/bn_exp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/bn/bn_exp.c b/crypto/bn/bn_exp.c
index 28a9fd53bb..8c46e50bdc 100644
--- a/crypto/bn/bn_exp.c
+++ b/crypto/bn/bn_exp.c
@@ -185,10 +185,10 @@ int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
goto err;
}
}
- ret = 1;
- err:
if (r != rr)
BN_copy(r, rr);
+ ret = 1;
+ err:
BN_CTX_end(ctx);
bn_check_top(r);
return (ret);