Comment 15 for bug 1899193

Revision history for this message
Julian Andres Klode (juliank) wrote :

> What happens with those return NULL cases if the data.tar or control.tar entries don't exist? Is that a new leak? I expected a self.release() before those cases.

OK, so release() releases ownership from the smart pointer to the caller (by setting the internal pointer to NULL and returning it).

Just returning NULL without calling release means the smart pointer object will decrement the reference count and hence deallocate it.

See https://en.cppreference.com/w/cpp/memory/unique_ptr/release for more information about the origin of the idiom.