Squashing final memory management bugs

This commit fixes the final memory management issues, some of which are actually in the GenomeTools source code (fixed with pull request 183 in GenomeTools).