vbox: handle errors of virDomainHostdevDefAlloc correctly
vbox: handle errors of virDomainHostdevDefAlloc correctly

The original code ignored errors of virDomainHostdevDefAlloc,
however, we should properly do error return from the function
if it occurs.

The fix pulls out virDomainHostdevDefAlloc from the loop and
executes it all together before the loop. So we can easily
return on errors without the notion of other memory allocations
in the loop.

The deallocation code is separated from the allocation code
because it will be used by a further patch for fixing other error
handlings.

Reported-by: Laine Stump <c23361c43fbf79fed83e8b76173707b083d6caf5@laine.org>
Signed-off-by: Ryota Ozaki <d18bd3af6589332ccdaa02f8dcaa552d52fbdad6@gmail.com>

fabianfreyer/libvirt,crobinso/libvirt,shugaoye/libvirt,elmarco/libvirt,jardasgit/libvirt,eskultety/libvirt,jardasgit/libvirt,shugaoye/libvirt,andreabolognani/libvirt,agx/libvirt,andreabolognani/libvirt,rlaager/libvirt,andreabolognani/libvirt,rlaager/libvirt,jfehlig/libvirt,taget/libvirt,jfehlig/libvirt,datto/libvirt,datto/libvirt,VenkatDatta/libvirt,eskultety/libvirt,libvirt/libvirt,taget/libvirt,fabianfreyer/libvirt,crobinso/libvirt,VenkatDatta/libvirt,shugaoye/libvirt,fabianfreyer/libvirt,zippy2/libvirt,VenkatDatta/libvirt,libvirt/libvirt,zippy2/libvirt,nertpinx/libvirt,crobinso/libvirt,rlaager/libvirt,nertpinx/libvirt,libvirt/libvirt,shugaoye/libvirt,agx/libvirt,fabianfreyer/libvirt,libvirt/libvirt,agx/libvirt,jfehlig/libvirt,eskultety/libvirt,VenkatDatta/libvirt,jardasgit/libvirt,nertpinx/libvirt,datto/libvirt,jardasgit/libvirt,olafhering/libvirt,rlaager/libvirt,agx/libvirt,nertpinx/libvirt,jfehlig/libvirt,olafhering/libvirt,agx/libvirt,VenkatDatta/libvirt,taget/libvirt,taget/libvirt,nertpinx/libvirt,shugaoye/libvirt,elmarco/libvirt,zippy2/libvirt,andreabolognani/libvirt,elmarco/libvirt,rlaager/libvirt,jardasgit/libvirt,zippy2/libvirt,fabianfreyer/libvirt,crobinso/libvirt,olafhering/libvirt,taget/libvirt,eskultety/libvirt,olafhering/libvirt,eskultety/libvirt,datto/libvirt,elmarco/libvirt,andreabolognani/libvirt,datto/libvirt,elmarco/libvirt