Fixed some irrelevant memory leaks.
Merge pull request #365 from LostTemplar/memcheck

Fixed some memory leaks.