From c66e344e38269227c93e598f599108a65b066fc0 Mon Sep 17 00:00:00 2001 From: Jim Fehlig Date: Fri, 16 Mar 2018 15:00:17 -0600 Subject: [PATCH] libxl: dont dereference NULL libxlDomainObjPrivatePtr In libxlDomainMigrationPrepare it is possible to dereference a NULL libxlDomainObjPrivatePtr in early error paths. Check for a valid 'priv' before using it. Signed-off-by: Jim Fehlig Reviewed-by: John Ferlan --- src/libxl/libxl_migration.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c index 324a1adde9..59de0b2785 100644 --- a/src/libxl/libxl_migration.c +++ b/src/libxl/libxl_migration.c @@ -804,9 +804,10 @@ libxlDomainMigrationPrepare(virConnectPtr dconn, } VIR_FREE(socks); virObjectUnref(args); - virPortAllocatorRelease(priv->migrationPort); - priv->migrationPort = 0; - + if (priv) { + virPortAllocatorRelease(priv->migrationPort); + priv->migrationPort = 0; + } /* Remove virDomainObj from domain list */ if (vm) { virDomainObjListRemove(driver->domains, vm);