Fix potential memory corruption

.idup on an immutable array (incl. string) was a no-op,
so we were leaking references to Data-owned memory.