projects
/
oweals
/
openssl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0e441bc
)
avoid potential spurious BN_free()
author
Bodo Möller
<bodo@openssl.org>
Tue, 23 Aug 2005 04:14:55 +0000
(
04:14
+0000)
committer
Bodo Möller
<bodo@openssl.org>
Tue, 23 Aug 2005 04:14:55 +0000
(
04:14
+0000)
Submitted by: David Heine <dlheine@suif.Stanford.EDU>
crypto/bn/bn_sqrt.c
patch
|
blob
|
history
diff --git
a/crypto/bn/bn_sqrt.c
b/crypto/bn/bn_sqrt.c
index c1eb7f6d49fd34d48aeeabfa37aa060bc5b6f7e3..6beaf9e5e5ddfd6da6942c67b045049a7c979ddb 100644
(file)
--- a/
crypto/bn/bn_sqrt.c
+++ b/
crypto/bn/bn_sqrt.c
@@
-83,7
+83,8
@@
BIGNUM *BN_mod_sqrt(BIGNUM *in, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
goto end;
if (!BN_set_word(ret, BN_is_bit_set(a, 0)))
{
- BN_free(ret);
+ if (ret != in)
+ BN_free(ret);
return NULL;
}
bn_check_top(ret);
@@
-102,7
+103,8
@@
BIGNUM *BN_mod_sqrt(BIGNUM *in, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
goto end;
if (!BN_set_word(ret, BN_is_one(a)))
{
- BN_free(ret);
+ if (ret != in)
+ BN_free(ret);
return NULL;
}
bn_check_top(ret);