libxl: fix segfault in libxlReconnectDomain
libxl: fix segfault in libxlReconnectDomain

In case of error, libxlReconnectDomain may call
virDomainObjListRemoveLocked. However it has no local reference on
the domain object, leading to segfault. Get a reference to the domain
object at the start of the function and release it at the end to avoid
problems.

This commit also factorizes code between the error and normal ends.

taget/libvirt,taget/libvirt,eskultety/libvirt,libvirt/libvirt,crobinso/libvirt,olafhering/libvirt,andreabolognani/libvirt,VenkatDatta/libvirt,jardasgit/libvirt,libvirt/libvirt,taget/libvirt,jardasgit/libvirt,olafhering/libvirt,jardasgit/libvirt,nertpinx/libvirt,taget/libvirt,nertpinx/libvirt,crobinso/libvirt,libvirt/libvirt,fabianfreyer/libvirt,eskultety/libvirt,zippy2/libvirt,VenkatDatta/libvirt,taget/libvirt,olafhering/libvirt,jfehlig/libvirt,VenkatDatta/libvirt,andreabolognani/libvirt,andreabolognani/libvirt,olafhering/libvirt,VenkatDatta/libvirt,eskultety/libvirt,eskultety/libvirt,nertpinx/libvirt,fabianfreyer/libvirt,zippy2/libvirt,jfehlig/libvirt,crobinso/libvirt,fabianfreyer/libvirt,eskultety/libvirt,jardasgit/libvirt,libvirt/libvirt,andreabolognani/libvirt,nertpinx/libvirt,VenkatDatta/libvirt,crobinso/libvirt,fabianfreyer/libvirt,fabianfreyer/libvirt,nertpinx/libvirt,datto/libvirt,datto/libvirt,zippy2/libvirt,datto/libvirt,jfehlig/libvirt,datto/libvirt,andreabolognani/libvirt,datto/libvirt,jardasgit/libvirt,jfehlig/libvirt,zippy2/libvirt