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 <jfehlig@suse.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
Jim Fehlig 2018-03-16 15:00:17 -06:00
parent 594b8b996c
commit c66e344e38

View File

@ -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);