libxl: Fix possible object refcnt issue
libxl: Fix possible object refcnt issue

When libxlDomainMigrationDstPrepare adds the @args to an
virNetSocketAddIOCallback using libxlMigrateDstReceive as
the target of the virNetSocketIOFunc @func with the knowledge
that the libxlMigrateDstReceive will virObjectUnref @args
at the end thus not needing to Unref during normal processing
for libxlDomainMigrationDstPrepare.

However, Coverity believes there's an issue with this. The
problem is there can be @nsocks virNetSocketAddIOCallback's
added, but only one virObjectUnref. That means the first
one done will Unref and the subsequent callers may not get
the @args (or @opaque) as they expected. If there's only
one socket returned from virNetSocketNewListenTCP, then sure
that works. However, if it returned more than one there's
going to be a problem.

To resolve this, since we start with 1 reference from the
virObjectNew for @args, we will add 1 reference for each
time @args is used for virNetSocketAddIOCallback. Then
since libxlDomainMigrationDstPrepare would be done with
@args, move it's virObjectUnref from the error: label to
the done: label (since error: falls through). That way
once the last IOCallback is done, then @args will be freed.

Signed-off-by: John Ferlan <87558058f6f829e5ec976c8ef960720af4ff9c7d@redhat.com>
ACKed-by: Michal Privoznik <83d82aaba2eed257f4814b0c239c260c4caaadf0@redhat.com>

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