File c66e344e-libxl-dont-deref-NULL.patch of Package libvirt.8367

commit c66e344e38269227c93e598f599108a65b066fc0
Author: Jim Fehlig <jfehlig@suse.com>
Date:   Fri Mar 16 15:00:17 2018 -0600

    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>

Index: libvirt-4.0.0/src/libxl/libxl_migration.c
===================================================================
--- libvirt-4.0.0.orig/src/libxl/libxl_migration.c
+++ libvirt-4.0.0/src/libxl/libxl_migration.c
@@ -804,8 +804,10 @@ libxlDomainMigrationPrepare(virConnectPt
     }
     VIR_FREE(socks);
     virObjectUnref(args);
-    virPortAllocatorRelease(driver->migrationPorts, priv->migrationPort);
-    priv->migrationPort = 0;
+    if (priv) {
+        virPortAllocatorRelease(driver->migrationPorts, priv->migrationPort);
+        priv->migrationPort = 0;
+    }
 
     /* Remove virDomainObj from domain list */
     if (vm) {