]> xenbits.xensource.com Git - libvirt.git/commitdiff
libxl: dont dereference NULL libxlDomainObjPrivatePtr
authorJim Fehlig <jfehlig@suse.com>
Fri, 16 Mar 2018 21:00:17 +0000 (15:00 -0600)
committerJim Fehlig <jfehlig@suse.com>
Wed, 21 Mar 2018 18:57:04 +0000 (12:57 -0600)
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>
src/libxl/libxl_migration.c

index 324a1adde974243c8581dd96dda063cf331cbd54..59de0b2785b63f513c5a09f5b1c12f7d377743da 100644 (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);