cid 10776 - fix double free
cid 10566 edge case: string not null terminated