aboutsummaryrefslogtreecommitdiffstats
path: root/skeletons
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2006-10-19 05:27:54 +0000
committerLev Walkin <vlm@lionet.info>2006-10-19 05:27:54 +0000
commit4f530b5208126c3473a0fba73ac6c57ac1c450a3 (patch)
treed359cb9ae9ae15a07029955ac919f61d894402a7 /skeletons
parent9ab21b8984dd5ef16a7d40a2f426f8e3f03989a3 (diff)
Memory leak fixed in SET OF / SEQUENCE OF in wrong encoding processing
Diffstat (limited to 'skeletons')
-rw-r--r--skeletons/constr_SET_OF.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/skeletons/constr_SET_OF.c b/skeletons/constr_SET_OF.c
index f9ade899..e6ba9854 100644
--- a/skeletons/constr_SET_OF.c
+++ b/skeletons/constr_SET_OF.c
@@ -227,6 +227,8 @@ SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
}
/* Fall through */
case RC_FAIL: /* Fatal error */
+ ASN_STRUCT_FREE(*elm->type, ctx->ptr);
+ ctx->ptr = 0;
RETURN(RC_FAIL);
} /* switch(rval) */
@@ -787,8 +789,10 @@ SET_OF_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
void
SET_OF_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) {
if(td && ptr) {
+ asn_SET_OF_specifics_t *specs;
asn_TYPE_member_t *elm = td->elements;
asn_anonymous_set_ *list = _A_SET_FROM_VOID(ptr);
+ asn_struct_ctx_t *ctx; /* Decoder context */
int i;
/*
@@ -807,6 +811,13 @@ SET_OF_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) {
if(!contents_only) {
FREEMEM(ptr);
}
+
+ specs = (asn_SET_OF_specifics_t *)td->specifics;
+ ctx = (asn_struct_ctx_t *)((char *)ptr + specs->ctx_offset);
+ if(ctx->ptr) {
+ ASN_STRUCT_FREE(*elm->type, ctx->ptr);
+ ctx->ptr = 0;
+ }
}
}