More memory leak and safety fixes; fix travis configuration.

Fix enough of the memory leaks and other problems reported by the travis build that we can turn on the new more-strictly-checking travis configuration.  Slowly reducing the number of leaking tests...