summaryrefslogtreecommitdiffstats
path: root/crypto/asn1/bio_asn1.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/asn1/bio_asn1.c')
-rw-r--r--crypto/asn1/bio_asn1.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/crypto/asn1/bio_asn1.c b/crypto/asn1/bio_asn1.c
index f792c08806..c6eabc0d61 100644
--- a/crypto/asn1/bio_asn1.c
+++ b/crypto/asn1/bio_asn1.c
@@ -100,10 +100,8 @@ static int asn1_bio_new(BIO *b)
{
BIO_ASN1_BUF_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
- if (ctx == NULL) {
- ERR_raise(ERR_LIB_ASN1, ERR_R_MALLOC_FAILURE);
+ if (ctx == NULL)
return 0;
- }
if (!asn1_bio_init(ctx, DEFAULT_ASN1_BUF_SIZE)) {
OPENSSL_free(ctx);
return 0;
@@ -116,10 +114,12 @@ static int asn1_bio_new(BIO *b)
static int asn1_bio_init(BIO_ASN1_BUF_CTX *ctx, int size)
{
- if (size <= 0 || (ctx->buf = OPENSSL_malloc(size)) == NULL) {
- ERR_raise(ERR_LIB_ASN1, ERR_R_MALLOC_FAILURE);
+ if (size <= 0) {
+ ERR_raise(ERR_LIB_ASN1, ERR_R_PASSED_INVALID_ARGUMENT);
return 0;
}
+ if ((ctx->buf = OPENSSL_malloc(size)) == NULL)
+ return 0;
ctx->bufsize = size;
ctx->asn1_class = V_ASN1_UNIVERSAL;
ctx->asn1_tag = V_ASN1_OCTET_STRING;