Fixes memory leaks pointed out by the static analyser
Merge pull request #75 from Jaxan/master

Fixes memory leaks pointed out by the static analyser