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(a)suse.com>
---
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 7dc39ae02..c1c23dab3 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);
--
2.16.2