From: Olaf Hering Date: Thu, 7 May 2015 08:54:26 +0000 (+0000) Subject: libxlu: handle NULL pointer in xlu_cfg_destroy X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~3289 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=3c9fd195d25109368a2cd928c34fa15a7f785540;p=xen.git libxlu: handle NULL pointer in xlu_cfg_destroy Handle NULL pointer passed to xlu_cfg_destroy. libvirt calls it in its libxlDriverConfigDispose function. If the XLU_Config was not initialized yet for some reason a crash would occur on cleanup. Avoid the crash just like libxl_ctx_free and xtl_logger_destroy do when called from the same context. Signed-off-by: Olaf Hering Cc: Ian Jackson Cc: Stefano Stabellini Cc: Ian Campbell Cc: Wei Liu Acked-by: Wei Liu --- diff --git a/tools/libxl/libxlu_cfg.c b/tools/libxl/libxlu_cfg.c index 0a59b5283e..1d709091cb 100644 --- a/tools/libxl/libxlu_cfg.c +++ b/tools/libxl/libxlu_cfg.c @@ -159,6 +159,7 @@ void xlu__cfg_set_free(XLU_ConfigSetting *set) { void xlu_cfg_destroy(XLU_Config *cfg) { XLU_ConfigSetting *set, *set_next; + if (!cfg) return; for (set= cfg->settings; set; set= set_next) {