Skip to contentSkip to conversation

: xl: Fix NULL deref in libxl_ctx_free()

PATCH New Gianni Tedesco 1 participant 1 message Sep 6, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : xl: Fix NULL deref in libxl_ctx_free()

xc_interface_close() will de-reference a NULL handle, check for this condition in libxl_ctx_free() before calling.

tools/libxl/libxl.c +1 -1
diff -r 245ea9337bb8 tools/libxl/libxl.c
@@ -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;