Add input cleanup

`ws_object_unref()` _only_ calls `free()` if the heap-alloced-flag is set.
If if does, it's a bug.