buffer_get_remainder() return pointer to chunk, not allocated copy anymore
fixed memory leaks