[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 04/14] libxl: make libxl_ctx_free tolerate NULL ctx argument



This is purely for convenience (eg, when debugging).

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/libxl.c |    1 +
 tools/libxl/libxl.h |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index fabad4a..d4a47f2 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -85,6 +85,7 @@ int libxl_ctx_alloc(libxl_ctx **pctx, int version, 
xentoollog_logger * lg)
 
 int libxl_ctx_free(libxl_ctx *ctx)
 {
+    if (!ctx) return 0;
     if (ctx->xch) xc_interface_close(ctx->xch);
     libxl_version_info_destroy(&ctx->version_info);
     if (ctx->xsh) xs_daemon_close(ctx->xsh); 
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index 95a7ba3..18a01c6 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -232,7 +232,7 @@ typedef struct {
 
 /* context functions */
 int libxl_ctx_alloc(libxl_ctx **pctx, int version, xentoollog_logger *lg);
-int libxl_ctx_free(libxl_ctx *ctx);
+int libxl_ctx_free(libxl_ctx *ctx /* 0 is OK */);
 int libxl_ctx_postfork(libxl_ctx *ctx);
 
 /* domain related functions */
-- 
1.7.2.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.