Fix a memory leak in SEQUENCE_free

Fixes check-src/check-135.-gen-OER.c and check-src/check64-136.-gen-OER.c
This commit is contained in:
Vasil Velichkov 2017-10-10 05:34:48 +03:00 committed by Lev Walkin
parent 84dd0fef6f
commit aead8c5f68
1 changed files with 7 additions and 0 deletions

View File

@ -994,6 +994,9 @@ 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;
asn_struct_ctx_t *ctx; /* Decoder context */
if(!td || !sptr)
return;
@ -1013,6 +1016,10 @@ SEQUENCE_free(const asn_TYPE_descriptor_t *td, void *sptr,
}
}
/* Clean parsing context */
ctx = (asn_struct_ctx_t *)((char *)sptr + specs->ctx_offset);
FREEMEM(ctx->ptr);
switch(method) {
case ASFM_FREE_EVERYTHING:
FREEMEM(sptr);