You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Buffer type seems to conflate ownership of the TF_Buffer object and the
ownership of the data wrapped by the TF_Buffer object.
A TF_Buffer object created through from_ptr() is created as 'borrowed'. As
a result, the TF_Buffer object is not deallocated, leadning to a memory
leak.
This commit makes two small changes to (hopefully) remedy the leak:
- from_ptr() sets the TF_Buffer to be owned, so that the drop() will
deallocate the TF_Buffer object. Since the TF_Buffer does not have
a data_deallocator set, the data is not freed when Buffer is dropped.
- into_ptr() does not change the TF_Buffer ownership, but instead sets
data_deallocator to NULL. As a consequence, the caller becomes responsible
for freeing the data and the TF_Buffer is deallocated by drop().
0 commit comments