Work on bad accesses and then memory leaks.

These were not getting freed.