BUG: fix leak and possible null dereference

not sure if this is the right thing, but it looks very strongly like assigning data1 to both entries was a typo.
Its probably harmless but would cause issues if one metadata is freed while the other is still needed.