settings: change de-serialization to return a newly allocated copy of data; add free_struct() to free this data