fix wrong memory usage in buildAndsendSetupRequest
Summary
- The function is supposed to re-allocate memory to increase buffer size,
when larger buffer is required to encode the given asn data,
but current impl doesn't do that, so it will lead us to seg fault or memory corruption.
Changes
- make the function to allocate memory in heap for asn encoding buffer rather than stack
- make the function to re-allocate memory when encoded data is larger than the given buffer
- free allocated memory
Issue-ID: RIC-697
Change-Id: I8862f1ee6bff27f898778ae896f8b41830ad6daa
Signed-off-by: Byonggon Chun <bg.chun@samsung.com>