Skip to content

Commit

Permalink
Merge pull request #155 from v0-e/td-null-check-fix
Browse files Browse the repository at this point in the history
SEQUENCE_free, CHOICE_free null pointer check fix
  • Loading branch information
mouse07410 authored Dec 16, 2023
2 parents df2b288 + 309f193 commit 57281aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions skeletons/constr_CHOICE.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/*
Expand Down
5 changes: 3 additions & 2 deletions skeletons/constr_SEQUENCE.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down

0 comments on commit 57281aa

Please sign in to comment.