Memory leak cleanup. Fixing some small things that were fixed in the Dolphin source, but didn't make it over here.