Merge pull request #8 from aselle/master

Memory leak pass
Fixing pedantic warnings