max_id could be used uninitialized in the cleanup section after the domain wasn't found. Discovered by Coverity.