summaryrefslogtreecommitdiffstats
path: root/crypto/asn1/bio_ndef.c
diff options
context:
space:
mode:
authorFdaSilvaYY <fdasilvayy@gmail.com>2016-03-06 21:40:58 +0100
committerFdaSilvaYY <fdasilvayy@gmail.com>2016-05-29 01:36:11 +0200
commitf59f23c38331e3adf58c0317caf319a7bfd82dd1 (patch)
treed2cea2e198f2d217dd688ee235217a473f00629d /crypto/asn1/bio_ndef.c
parent8e89e85f556f549f05d3b49f5408a217ac5e3700 (diff)
Add more zalloc
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/997)
Diffstat (limited to 'crypto/asn1/bio_ndef.c')
-rw-r--r--crypto/asn1/bio_ndef.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/crypto/asn1/bio_ndef.c b/crypto/asn1/bio_ndef.c
index c43d2da4a4..0f206b2497 100644
--- a/crypto/asn1/bio_ndef.c
+++ b/crypto/asn1/bio_ndef.c
@@ -60,14 +60,14 @@ BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it)
ASN1err(ASN1_F_BIO_NEW_NDEF, ASN1_R_STREAMING_NOT_SUPPORTED);
return NULL;
}
- ndef_aux = OPENSSL_malloc(sizeof(*ndef_aux));
+ ndef_aux = OPENSSL_zalloc(sizeof(*ndef_aux));
asn_bio = BIO_new(BIO_f_asn1());
+ if (ndef_aux == NULL || asn_bio == NULL)
+ goto err;
/* ASN1 bio needs to be next to output BIO */
-
out = BIO_push(asn_bio, out);
-
- if (ndef_aux == NULL || asn_bio == NULL || !out)
+ if (out == NULL)
goto err;
BIO_asn1_set_prefix(asn_bio, ndef_prefix, ndef_prefix_free);
@@ -90,7 +90,6 @@ BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it)
ndef_aux->ndef_bio = sarg.ndef_bio;
ndef_aux->boundary = sarg.boundary;
ndef_aux->out = out;
- ndef_aux->derbuf = NULL;
BIO_ctrl(asn_bio, BIO_C_SET_EX_ARG, 0, ndef_aux);