提交 e0bf5c11 编写于 作者: B Bodo Möller

Handle BN_copy failure after successful BN_new.

上级 58f0f52e
...@@ -507,15 +507,19 @@ BIGNUM *bn_expand2(BIGNUM *b, int words) ...@@ -507,15 +507,19 @@ BIGNUM *bn_expand2(BIGNUM *b, int words)
BIGNUM *BN_dup(const BIGNUM *a) BIGNUM *BN_dup(const BIGNUM *a)
{ {
BIGNUM *r; BIGNUM *r, *t;
if (a == NULL) return NULL; if (a == NULL) return NULL;
bn_check_top(a); bn_check_top(a);
r=BN_new(); t = BN_new();
if (r == NULL) return(NULL); if (t == NULL) return(NULL);
return((BIGNUM *)BN_copy(r,a)); r = BN_copy(t, a);
/* now r == t || r == NULL */
if (r == NULL)
BN_free(t);
return r;
} }
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册