aboutsummaryrefslogtreecommitdiff
path: root/crypto/x509v3
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2018-07-25 15:57:18 -0400
committerRich Salz <rsalz@openssl.org>2018-07-25 15:57:18 -0400
commit037241bf046be8cfc7e9216959393dd20b06fc21 (patch)
tree121dc3959fe8b22107748500fb416f83bd1747f7 /crypto/x509v3
parent80ae7285e1994d35c84519bf9e038b11d9942875 (diff)
downloadopenssl-037241bf046be8cfc7e9216959393dd20b06fc21.zip
openssl-037241bf046be8cfc7e9216959393dd20b06fc21.tar.gz
openssl-037241bf046be8cfc7e9216959393dd20b06fc21.tar.bz2
Check for failures, to avoid memory leak
Thanks to Jiecheng Wu, Zuxing Gu for the report. Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6791)
Diffstat (limited to 'crypto/x509v3')
-rw-r--r--crypto/x509v3/v3_tlsf.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/crypto/x509v3/v3_tlsf.c b/crypto/x509v3/v3_tlsf.c
index 5f2d5d2..61c1638 100644
--- a/crypto/x509v3/v3_tlsf.c
+++ b/crypto/x509v3/v3_tlsf.c
@@ -122,13 +122,12 @@ static TLS_FEATURE *v2i_TLS_FEATURE(const X509V3_EXT_METHOD *method,
}
}
- ai = ASN1_INTEGER_new();
- if (ai == NULL) {
+ if ((ai = ASN1_INTEGER_new()) == NULL
+ || !ASN1_INTEGER_set(ai, tlsextid)
+ || sk_ASN1_INTEGER_push(tlsf, ai) <= 0) {
X509V3err(X509V3_F_V2I_TLS_FEATURE, ERR_R_MALLOC_FAILURE);
goto err;
}
- ASN1_INTEGER_set(ai, tlsextid);
- sk_ASN1_INTEGER_push(tlsf, ai);
}
return tlsf;