From: Gianni Tedesco Subject: [PATCH]: xl: Fix NULL deref in libxl_ctx_free() Date: Mon, 6 Sep 2010 14:20:19 +0100 Message-ID: <1283779219.20276.141.camel@qabil.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Xen Devel Cc: Ian Jackson , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org xc_interface_close() will de-reference a NULL handle, check for this condition in libxl_ctx_free() before calling. Signed-off-by: Gianni Tedesco diff -r 245ea9337bb8 tools/libxl/libxl.c --- a/tools/libxl/libxl.c Mon Sep 06 14:17:06 2010 +0100 +++ b/tools/libxl/libxl.c Mon Sep 06 14:20:07 2010 +0100 @@ -67,7 +67,7 @@ int libxl_ctx_init(libxl_ctx *ctx, int v int libxl_ctx_free(libxl_ctx *ctx) { - xc_interface_close(ctx->xch); + if (ctx->xch) xc_interface_close(ctx->xch); libxl_version_info_destroy(&ctx->version_info); if (ctx->xsh) xs_daemon_close(ctx->xsh); return 0;