nut-tree/libnut-core

Change semantics or remove BufferFinalizer

s1hofmann opened this issue · 0 comments

Short overview
Semantics of BufferFinalizer are unspecified. We should either get rid of it or fix their behavior.

Detailed description
Buffer finalizers are called when a Buffer gets destroyed and it's used by libnut to deal with underlying memory.
However, since the underlying memory is allocated via malloc and the BufferFinalizer calls delete on it, we might run into trouble since this is unspecified behaviour.

We could get rid of these finalizers by using Buffer::Copy and free allocated memory ourselfs, or we just update the finalizer to use free