if (ef != NULL) {
if (ef->asn1_ex_new_ex != NULL) {
if (!ef->asn1_ex_new_ex(pval, it, libctx, propq))
- goto memerr;
+ goto asn1err;
} else if (ef->asn1_ex_new != NULL) {
if (!ef->asn1_ex_new(pval, it))
- goto memerr;
+ goto asn1err;
}
}
break;
case ASN1_ITYPE_PRIMITIVE:
if (it->templates) {
if (!asn1_template_new(pval, it->templates, libctx, propq))
- goto memerr;
+ goto asn1err;
} else if (!asn1_primitive_new(pval, it, embed))
- goto memerr;
+ goto asn1err;
break;
case ASN1_ITYPE_MSTRING:
if (!asn1_primitive_new(pval, it, embed))
- goto memerr;
+ goto asn1err;
break;
case ASN1_ITYPE_CHOICE:
} else {
*pval = OPENSSL_zalloc(it->size);
if (*pval == NULL)
- goto memerr;
+ return 0;
}
ossl_asn1_set_choice_selector(pval, -1, it);
if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
} else {
*pval = OPENSSL_zalloc(it->size);
if (*pval == NULL)
- goto memerr;
+ return 0;
}
/* 0 : init. lock */
if (ossl_asn1_do_lock(pval, 0, it) < 0) {
OPENSSL_free(*pval);
*pval = NULL;
}
- goto memerr;
+ goto asn1err;
}
ossl_asn1_enc_init(pval, it);
for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) {
pseqval = ossl_asn1_get_field_ptr(pval, tt);
if (!asn1_template_new(pseqval, tt, libctx, propq))
- goto memerr2;
+ goto asn1err2;
}
if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
goto auxerr2;
}
return 1;
- memerr2:
+ asn1err2:
ossl_asn1_item_embed_free(pval, it, embed);
- memerr:
- ERR_raise(ERR_LIB_ASN1, ERR_R_MALLOC_FAILURE);
+ asn1err:
+ ERR_raise(ERR_LIB_ASN1, ERR_R_ASN1_LIB);
return 0;
auxerr2:
STACK_OF(ASN1_VALUE) *skval;
skval = sk_ASN1_VALUE_new_null();
if (!skval) {
- ERR_raise(ERR_LIB_ASN1, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_ASN1, ERR_R_CRYPTO_LIB);
ret = 0;
goto done;
}
return 1;
case V_ASN1_ANY:
- if ((typ = OPENSSL_malloc(sizeof(*typ))) == NULL) {
- ERR_raise(ERR_LIB_ASN1, ERR_R_MALLOC_FAILURE);
+ if ((typ = OPENSSL_malloc(sizeof(*typ))) == NULL)
return 0;
- }
typ->value.ptr = NULL;
typ->type = -1;
*pval = (ASN1_VALUE *)typ;