Fix sink-related memory leak.