fixed leaks in CHOICE/XER and REAL conversion
diff --git a/skeletons/constr_CHOICE.c b/skeletons/constr_CHOICE.c
index 4ecb220..f3a53d3 100644
--- a/skeletons/constr_CHOICE.c
+++ b/skeletons/constr_CHOICE.c
@@ -605,6 +605,7 @@
asn_dec_rval_t tmprval;
void *memb_ptr; /* Pointer to the member */
void **memb_ptr2; /* Pointer to that pointer */
+ unsigned old_present;
elm = &td->elements[edx];
@@ -624,13 +625,14 @@
XER_ADVANCE(tmprval.consumed);
ASN_DEBUG("XER/CHOICE: itdf: [%s] code=%d",
elm->type->name, tmprval.code);
- if(tmprval.code != RC_OK)
- RETURN(tmprval.code);
- assert(_fetch_present_idx(st,
- specs->pres_offset, specs->pres_size) == 0);
+ old_present = _fetch_present_idx(st,
+ specs->pres_offset, specs->pres_size);
+ assert(old_present == 0 || old_present == edx + 1);
/* Record what we've got */
_set_present_idx(st,
specs->pres_offset, specs->pres_size, edx + 1);
+ if(tmprval.code != RC_OK)
+ RETURN(tmprval.code);
ctx->phase = 3;
/* Fall through */
}