When we build up a RingBuffer object via the RingBufferBuilder::build() function, we may leak memory on error paths, because of the usage of raw pointers.
Fix the issue by:
1) stop converting boxes into raw pointers to begin with, which should
be fine given that libbpf does not actually dereference the sample
callback pointer in ring_buffer__new() or ring_buffer__add().
2) properly freeing the ring buffer if we return early because we failed
to successfully add a callback.
When we build up a RingBuffer object via the RingBufferBuilder::build() function, we may leak memory on error paths, because of the usage of raw pointers. Fix the issue by: 1) stop converting boxes into raw pointers to begin with, which should be fine given that libbpf does not actually dereference the sample callback pointer in ring_buffer__new() or ring_buffer__add(). 2) properly freeing the ring buffer if we return early because we failed to successfully add a callback.
Closes: #862