Fixes some memory leaks
Fix small bug in melee checking
Merge pull request #564 from louisdx/memoryleaks

Fixes some memory leaks