free resources in destructor

Issue(s) found via [cppcheck](http://cppcheck.sourceforge.net/).