From 91ac80a9863d8b6c5c1fa64419c38d3bb474037d Mon Sep 17 00:00:00 2001 From: Joao Martins Date: Wed, 8 Feb 2017 12:32:36 +0000 Subject: [PATCH] xenconfig: fix xml to xl.cfg conversion with no graphics 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 --- src/xenconfig/xen_xl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c index 2c9174e536..74f68b38db 100644 --- a/src/xenconfig/xen_xl.c +++ b/src/xenconfig/xen_xl.c @@ -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) { -- GitLab