Fix memory leak with domains
Merge pull request #567 from brianc/fix-memory-leak

Fix memory leak with domains