summaryrefslogtreecommitdiff
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:32:22 +0000
commitcc27bec2b40ca6741125cbeef6a214dfbe1f85f9 (patch)
treea552b88da9a9d427e5c95c1b5df85a54fd383f5e
parentf5ee5213073870493a8ade98b13ea41a2b20b8d4 (diff)
downloadopenssl-new-cc27bec2b40ca6741125cbeef6a214dfbe1f85f9.tar.gz
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)
-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 fca401450a..27146c89e7 100644
--- a/crypto/bn/bn_exp.c
+++ b/crypto/bn/bn_exp.c
@@ -168,10 +168,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);