summaryrefslogtreecommitdiff
path: root/deps/openssl/openssl/crypto/asn1/tasn_enc.c
diff options
context:
space:
mode:
Diffstat (limited to 'deps/openssl/openssl/crypto/asn1/tasn_enc.c')
-rw-r--r--deps/openssl/openssl/crypto/asn1/tasn_enc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/deps/openssl/openssl/crypto/asn1/tasn_enc.c b/deps/openssl/openssl/crypto/asn1/tasn_enc.c
index 3b723a1845..30be314ff9 100644
--- a/deps/openssl/openssl/crypto/asn1/tasn_enc.c
+++ b/deps/openssl/openssl/crypto/asn1/tasn_enc.c
@@ -57,12 +57,14 @@ static int asn1_item_flags_i2d(ASN1_VALUE *val, unsigned char **out,
if (out && !*out) {
unsigned char *p, *buf;
int len;
+
len = ASN1_item_ex_i2d(&val, NULL, it, -1, flags);
if (len <= 0)
return len;
- buf = OPENSSL_malloc(len);
- if (buf == NULL)
+ if ((buf = OPENSSL_malloc(len)) == NULL) {
+ ASN1err(ASN1_F_ASN1_ITEM_FLAGS_I2D, ERR_R_MALLOC_FAILURE);
return -1;
+ }
p = buf;
ASN1_item_ex_i2d(&val, &p, it, -1, flags);
*out = buf;