Merge pull request #6 from prasannatsm/master

Fixed memory leaks reported by cppcheck.