]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
xenconfig: fix xml to xl.cfg conversion with no graphics
authorJoao Martins <joao.m.martins@oracle.com>
Wed, 8 Feb 2017 12:32:36 +0000 (12:32 +0000)
committerJim Fehlig <jfehlig@suse.com>
Wed, 8 Feb 2017 15:41:13 +0000 (08:41 -0700)
If no graphics element is in XML xenFormatXLSpice will access
graphics without checking it has one in the first place, leading to a
segmentation fault.

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
src/xenconfig/xen_xl.c

index 2c9174e5363d24126cb3e7441d8171b8ac33e6f8..74f68b38db427d93c49666bdf521601f279c18ad 100644 (file)
@@ -1168,7 +1168,7 @@ xenFormatXLSpice(virConfPtr conf, virDomainDefPtr def)
     virDomainGraphicsListenDefPtr glisten;
     virDomainGraphicsDefPtr graphics;
 
-    if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
+    if (def->os.type == VIR_DOMAIN_OSTYPE_HVM && def->graphics) {
         graphics = def->graphics[0];
 
         if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {