From: Jim Fehlig Date: Fri, 16 Mar 2018 21:00:17 +0000 (-0600) Subject: libxl: dont dereference NULL libxlDomainObjPrivatePtr X-Git-Tag: v4.2.0-rc1~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c66e344e38269227c93e598f599108a65b066fc0;p=thirdparty%2Flibvirt.git 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 --- 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);