Move unref of input Buffer to C++ #138