Add input cleanup

You made it sound like if you were worried about freeing a stack reference.

The devices member is a ws_set.