From d094e95fb7c61c5f46d8e446b4bdc028438dea1c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pawe=C5=82=20Marczewski?= Date: Fri, 13 Mar 2020 11:25:10 +0000 Subject: [PATCH] libxl: fix cleanup bug in initiate_domain_create() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In case of errors, we immediately call domcreate_complete() which cleans up the console_xswait object. Make sure it is initialized before we start cleanup. Signed-off-by: Paweł Marczewski Reviewed-by: Ian Jackson --- tools/libxl/libxl_create.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 7891fae426..772344c648 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -1168,6 +1168,8 @@ static void initiate_domain_create(libxl__egc *egc, libxl_domain_config *const d_config = dcs->guest_config; const int restore_fd = dcs->restore_fd; + libxl__xswait_init(&dcs->console_xswait); + domid = dcs->domid; libxl__domain_build_state_init(&dcs->build_state); @@ -1219,8 +1221,6 @@ static void initiate_domain_create(libxl__egc *egc, if (ret) goto error_out; - libxl__xswait_init(&dcs->console_xswait); - if (restore_fd >= 0 || dcs->soft_reset) { LOGD(DEBUG, domid, "restoring, not running bootloader"); domcreate_bootloader_done(egc, &dcs->bl, 0); -- 2.30.2