Fix leak, and double free on quit