summaryrefslogtreecommitdiff
path: root/src/crypto/asn1/tasn_new.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/crypto/asn1/tasn_new.c')
-rw-r--r--src/crypto/asn1/tasn_new.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/crypto/asn1/tasn_new.c b/src/crypto/asn1/tasn_new.c
index 8a90b436..76c52c3e 100644
--- a/src/crypto/asn1/tasn_new.c
+++ b/src/crypto/asn1/tasn_new.c
@@ -127,11 +127,10 @@ int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it) {
return 1;
}
}
- *pval = OPENSSL_malloc(it->size);
+ *pval = OPENSSL_zalloc(it->size);
if (!*pval) {
goto memerr;
}
- OPENSSL_memset(*pval, 0, it->size);
asn1_set_choice_selector(pval, -1, it);
if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL)) {
goto auxerr2;
@@ -151,11 +150,10 @@ int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it) {
return 1;
}
}
- *pval = OPENSSL_malloc(it->size);
+ *pval = OPENSSL_zalloc(it->size);
if (!*pval) {
goto memerr;
}
- OPENSSL_memset(*pval, 0, it->size);
asn1_refcount_set_one(pval, it);
asn1_enc_init(pval, it);
for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) {
@@ -185,16 +183,9 @@ auxerr:
}
static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it) {
- const ASN1_EXTERN_FUNCS *ef;
-
switch (it->itype) {
case ASN1_ITYPE_EXTERN:
- ef = it->funcs;
- if (ef && ef->asn1_ex_clear) {
- ef->asn1_ex_clear(pval, it);
- } else {
- *pval = NULL;
- }
+ *pval = NULL;
break;
case ASN1_ITYPE_PRIMITIVE:
@@ -276,7 +267,7 @@ static int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it) {
}
switch (utype) {
case V_ASN1_OBJECT:
- *pval = (ASN1_VALUE *)OBJ_nid2obj(NID_undef);
+ *pval = (ASN1_VALUE *)OBJ_get_undef();
return 1;
case V_ASN1_BOOLEAN: