Skip to content

Commit 2669a7f

Browse files
authored
Merge pull request vlm#12 from brchiu/zero_out_structure_when_free_content_only
Zero out memory when free content only
2 parents 4fc4f8f + f75d1a9 commit 2669a7f

File tree

5 files changed

+10
-0
lines changed

5 files changed

+10
-0
lines changed

skeletons/OCTET_STRING.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2104,6 +2104,8 @@ OCTET_STRING_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) {
21042104

21052105
if(!contents_only) {
21062106
FREEMEM(st);
2107+
} else if(td->specifics) {
2108+
memset(st, 0, ((asn_OCTET_STRING_specifics_t *)(td->specifics))->struct_size);
21072109
}
21082110
}
21092111

skeletons/constr_CHOICE.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,6 +1225,8 @@ CHOICE_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) {
12251225

12261226
if(!contents_only) {
12271227
FREEMEM(ptr);
1228+
} else if(td->specifics) {
1229+
memset(ptr, 0, ((asn_CHOICE_specifics_t *)(td->specifics))->struct_size);
12281230
}
12291231
}
12301232

skeletons/constr_SEQUENCE.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,8 @@ SEQUENCE_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) {
972972

973973
if(!contents_only) {
974974
FREEMEM(sptr);
975+
} else if(td->specifics) {
976+
memset(sptr, 0, ((asn_SEQUENCE_specifics_t *)(td->specifics))->struct_size);
975977
}
976978
}
977979

skeletons/constr_SET.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,6 +1121,8 @@ SET_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) {
11211121

11221122
if(!contents_only) {
11231123
FREEMEM(ptr);
1124+
} else if(td->specifics) {
1125+
memset(ptr, 0, ((asn_SET_specifics_t *)(td->specifics))->struct_size);
11241126
}
11251127
}
11261128

skeletons/constr_SET_OF.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,8 @@ SET_OF_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) {
818818

819819
if(!contents_only) {
820820
FREEMEM(ptr);
821+
} else if(td->specifics) {
822+
memset(ptr, 0, ((asn_SET_OF_specifics_t *)(td->specifics))->struct_size);
821823
}
822824
}
823825
}

0 commit comments

Comments
 (0)