Fix mem leak and mismatched new/delete
Merge pull request #354 from asmaloney:fix_mem_dealloc