Fixed memory leaks reported by cppcheck.
Merge pull request #6 from prasannatsm/master

Fixed memory leaks reported by cppcheck.