From: Vincent Hanquez Subject: [PATCH 01/11] change semantics of ctx_free and remove ctx_close Date: Tue, 29 Dec 2009 18:06:49 +0000 Message-ID: <1262110019-31072-2-git-send-email-vincent.hanquez@eu.citrix.com> References: <1262110019-31072-1-git-send-email-vincent.hanquez@eu.citrix.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------1.6.5.6" Return-path: In-Reply-To: <1262110019-31072-1-git-send-email-vincent.hanquez@eu.citrix.com> 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@lists.xensource.com Cc: Vincent Hanquez List-Id: xen-devel@lists.xenproject.org --------------1.6.5.6 Content-Type: text/plain; charset="UTF-8"; format=fixed Content-Transfer-Encoding: quoted-printable ctx_close isn't use anywhere, and free reallocate the GC array, which is quite surprising and lead to memory leaking in xl.c Signed-off-by: Vincent Hanquez --- tools/libxl/libxl.c | 10 ---------- tools/libxl/libxl.h | 1 - 2 files changed, 0 insertions(+), 11 deletions(-) --------------1.6.5.6 Content-Type: text/x-patch; name="0001-change-semantics-of-ctx_free-and-remove-ctx_close.patch" Content-Disposition: attachment; filename="0001-change-semantics-of-ctx_free-and-remove-ctx_close.patch" Content-Transfer-Encoding: quoted-printable diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 043a827..ecc3bc2 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -53,16 +53,6 @@ int libxl_ctx_free(struct libxl_ctx *ctx) { libxl_free_all(ctx); free(ctx->alloc_ptrs); - ctx->alloc_ptrs =3D calloc(ctx->alloc_maxsize, sizeof(void *)); - if (!ctx->alloc_ptrs) - return ERROR_NOMEM; - return 0; -} - -int libxl_ctx_close(struct libxl_ctx *ctx) -{ - libxl_ctx_free(ctx); - free(ctx->alloc_ptrs); xc_interface_close(ctx->xch); xs_daemon_close(ctx->xsh);=20 return 0; diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 3e0e281..cc6ecee 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -253,7 +253,6 @@ void xl_log(struct libxl_ctx *ctx, int errnoval, int = loglevel, const char *file, /* context functions */ int libxl_ctx_init(struct libxl_ctx *ctx); int libxl_ctx_free(struct libxl_ctx *ctx); -int libxl_ctx_close(struct libxl_ctx *ctx); int libxl_ctx_set_log(struct libxl_ctx *ctx, libxl_log_callback log_call= back, void *log_data); =20 /* domain related functions */ --------------1.6.5.6 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------1.6.5.6--