add helper method to free direct buffers