This assumes unbounded memory, which is a dangerous assumption.
Something should probably be done when testing error_set returns true.
Have to cast away const for unmarshal