tests: Fix memory leaks in test-add-libvirt-dom.

Found by valgrind.

This fixes commit df9782ec3a12ac46e1b8ffa31630c7a1e64162fe
and commit 96158d42f5cb9b6c472b4630f2c97edae600f6d3.