fix potential leaks in dmg format