compositor: fix memory corruption when removing an output