mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-09 01:04:59 +00:00
libxl: Add refcnt for args->conn during migration
Since the @dconn reference via args->conn will be used via a thread or callback, let's make sure memory associated with it isn't free'd unexpectedly before we use it. The Unref will be done when the object is Dispose'd. Signed-off-by: John Ferlan <jferlan@redhat.com> Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
8369ddfd1b
commit
faa148bc5d
@ -239,6 +239,7 @@ libxlMigrationDstArgsDispose(void *obj)
|
||||
|
||||
libxlMigrationCookieFree(args->migcookie);
|
||||
VIR_FREE(args->socks);
|
||||
virObjectUnref(args->conn);
|
||||
virObjectUnref(args->vm);
|
||||
}
|
||||
|
||||
@ -608,7 +609,7 @@ libxlDomainMigrationDstPrepareTunnel3(virConnectPtr dconn,
|
||||
if (!(args = virObjectNew(libxlMigrationDstArgsClass)))
|
||||
goto error;
|
||||
|
||||
args->conn = dconn;
|
||||
args->conn = virObjectRef(dconn);
|
||||
args->vm = virObjectRef(vm);
|
||||
args->flags = flags;
|
||||
args->migcookie = mig;
|
||||
@ -763,7 +764,7 @@ libxlDomainMigrationDstPrepare(virConnectPtr dconn,
|
||||
if (!(args = virObjectNew(libxlMigrationDstArgsClass)))
|
||||
goto error;
|
||||
|
||||
args->conn = dconn;
|
||||
args->conn = virObjectRef(dconn);
|
||||
args->vm = virObjectRef(vm);
|
||||
args->flags = flags;
|
||||
args->socks = socks;
|
||||
|
Loading…
Reference in New Issue
Block a user