From 309f193a327fbc64a67ff34342357f76ca1f0dcb Mon Sep 17 00:00:00 2001 From: v0-e Date: Sat, 16 Dec 2023 00:07:09 +0000 Subject: [PATCH] SEQUENCE_free, CHOICE_free null pointer check fix --- skeletons/constr_CHOICE.c | 5 +++-- skeletons/constr_SEQUENCE.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/skeletons/constr_CHOICE.c b/skeletons/constr_CHOICE.c index 1ba26552c..2ddfeb406 100644 --- a/skeletons/constr_CHOICE.c +++ b/skeletons/constr_CHOICE.c @@ -156,13 +156,14 @@ CHOICE_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, void CHOICE_free(const asn_TYPE_descriptor_t *td, void *ptr, enum asn_struct_free_method method) { - const asn_CHOICE_specifics_t *specs = - (const asn_CHOICE_specifics_t *)td->specifics; + const asn_CHOICE_specifics_t *specs; unsigned present; if(!td || !ptr) return; + specs = (const asn_CHOICE_specifics_t *)td->specifics; + ASN_DEBUG("Freeing %s as CHOICE", td->name); /* diff --git a/skeletons/constr_SEQUENCE.c b/skeletons/constr_SEQUENCE.c index 16861c6c4..ab7fe3252 100644 --- a/skeletons/constr_SEQUENCE.c +++ b/skeletons/constr_SEQUENCE.c @@ -68,13 +68,14 @@ void SEQUENCE_free(const asn_TYPE_descriptor_t *td, void *sptr, enum asn_struct_free_method method) { size_t edx; - const asn_SEQUENCE_specifics_t *specs = - (const asn_SEQUENCE_specifics_t *)td->specifics; + const asn_SEQUENCE_specifics_t *specs; asn_struct_ctx_t *ctx; /* Decoder context */ if(!td || !sptr) return; + specs = (const asn_SEQUENCE_specifics_t *)td->specifics; + ASN_DEBUG("Freeing %s as SEQUENCE", td->name); for(edx = 0; edx < td->elements_count; edx++) {