On Tue, Apr 24, 2018 at 02:28 PM +0200, John Ferlan <jferlan(a)redhat.com> wrote:
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(a)redhat.com>
---
src/libxl/libxl_migration.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c
index 7fe352306c..d37a4a687a 100644
--- a/src/libxl/libxl_migration.c
+++ b/src/libxl/libxl_migration.c
@@ -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;
--
2.13.6
--
libvir-list mailing list
libvir-list(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Reviewed-by: Marc Hartmayer <mhartmay(a)linux.vnet.ibm.com>
--
Beste Grüße / Kind regards
Marc Hartmayer
IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294