Fix memleak

Fix leak when using ISP, org or the domain database.