Check for duplicate entries when using dexlayout

The previous approach always inserted in the CollectionMap. This did
not work correctly if two different objects had the same offset. Since
we constructed a unique_ptr of the object, it would simply get freed
if the insert failed because there was already an object with the same
offset.

This meant that there were some use after free errors for these
objects.

Test: dexlayout -a -b hulu.apk

Bug: 35305951
Change-Id: I217e6d83bf6e051b13b1a601ec25512f40593880
2 files changed