Fix bug (Unreleased memory)

Release unreleased memory `vals`