Few minor issues highlighted by cppcheck/valgrind.
Merge pull request #24 from af4t/master

Forgot to update changelog.txt earlier