Closed pespin closed 2 years ago
@mouse07410 please merge this ASAP.
Wow... @pespin good catch!! Thank you!
@mouse07410 it was breaking my osmo-cbc unit tests ;)
It may be good to add a unit test under asn1c which does:
void *buf = malloc(1000);
void *old_buf = buf;
aper_decode_complete(NULL, &asn_DEF_whatever_type_to_test_like_CHOICE,
(void **)&pdu, input_encoded_arr, sizeof(input_encoded_arr));
assert (old_buf == buf);
Without this patch applied, the unit test would fail, since buf would be a newly allocated buffer.
@pespin I agree. Would you be able to add such a test?
Recent commit abd1faa6cf396ab1a4cddbe637f80316aa2cdef0 broke passing already existing output decoded structre as sptr. As a result, a new sptr was always allocated, and the old one leaked.
Fixes: abd1faa6cf396ab1a4cddbe637f80316aa2cdef0