summaryrefslogtreecommitdiffstats
path: root/crypto/asn1
diff options
context:
space:
mode:
authormrpre <mrpre@163.com>2015-08-28 16:12:51 +0800
committerRich Salz <rsalz@openssl.org>2015-08-31 16:04:39 -0400
commitcae70cfd46d9b266c9e4a32c8a588235663ce091 (patch)
tree9d1d0ae8301db20dbf6005da695ca476eb4531b7 /crypto/asn1
parentdf1565ed9cebb6933ee7c6e762abcfefd1cd3846 (diff)
check bn_new return value
Slightly modified from the original PR. Signed-off-by: Rich Salz <rsalz@akamai.com> Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit a7e974c7be90e2c9673e2ce6215a70f734eb8ad4)
Diffstat (limited to 'crypto/asn1')
-rw-r--r--crypto/asn1/x_bignum.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/asn1/x_bignum.c b/crypto/asn1/x_bignum.c
index a5a403c26e..eaf046639d 100644
--- a/crypto/asn1/x_bignum.c
+++ b/crypto/asn1/x_bignum.c
@@ -141,8 +141,9 @@ static int bn_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
int utype, char *free_cont, const ASN1_ITEM *it)
{
BIGNUM *bn;
- if (!*pval)
- bn_new(pval, it);
+
+ if (*pval == NULL && !bn_new(pval, it))
+ return 0;
bn = (BIGNUM *)*pval;
if (!BN_bin2bn(cont, len, bn)) {
bn_free(pval, it);