summaryrefslogtreecommitdiffstats
path: root/crypto/asn1/tasn_utl.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/asn1/tasn_utl.c')
-rw-r--r--crypto/asn1/tasn_utl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/asn1/tasn_utl.c b/crypto/asn1/tasn_utl.c
index cf434aa23c..11e3a3405d 100644
--- a/crypto/asn1/tasn_utl.c
+++ b/crypto/asn1/tasn_utl.c
@@ -133,9 +133,10 @@ int asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen,
return 1;
OPENSSL_free(enc->enc);
- enc->enc = OPENSSL_malloc(inlen);
- if (enc->enc == NULL)
+ if ((enc->enc = OPENSSL_malloc(inlen)) == NULL) {
+ ASN1err(ASN1_F_ASN1_ENC_SAVE, ERR_R_MALLOC_FAILURE);
return 0;
+ }
memcpy(enc->enc, in, inlen);
enc->len = inlen;
enc->modified = 0;