Fixed dangling malloc
Merge pull request #6 from csimmend/master

fixed malloc