Fix memory leak
Merge pull request #5 from ratash/master

Fix memory leaks