Starter bug: SR-1286 Incorrect memory management in PotentialArchetype::getNestedType
I diagnosed a memory error that causes a compiler crash, but I didn't fix it. There are several possible changes with potentially different performance trade-offs. There are also possibly similar bugs nearby; if so a change to a safer data structure might be in order.
Your job: examine the nearby code, evaluate the trade-offs, and write a fix.