Fix some leaks revealed by Coverity

This changeset fixes a few of the 'Resource Leaks' reported by Coverity. Nothing too controversial here...