If judgment is rendered in the action for the defendant, the attachment shall be discharged, and the property attached, or its proceeds, shall be returned to him.