From: Gianni Tedesco Subject: RE: [PATCH V5] libxl: make libxl communicate with xenstored by socket or xenbus driver Date: Fri, 17 Sep 2010 15:21:59 +0100 Message-ID: <1284733319.1914.41.camel@qabil.uk.xensource.com> References: <433DDF91DFB08148BAD3FDB6FDDA314C9F35F3BB70@LONPMAILBOX01.citrite.net> <433DDF91DFB08148BAD3FDB6FDDA314C9F35F3BB72@LONPMAILBOX01.citrite.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <433DDF91DFB08148BAD3FDB6FDDA314C9F35F3BB72@LONPMAILBOX01.citrite.net> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "Jun Zhu (Intern)" Cc: Ian Campbell , "xen-devel@lists.xensource.com" , Ian Jackson List-Id: xen-devel@lists.xenproject.org On Fri, 2010-09-17 at 15:12 +0100, Jun Zhu (Intern) wrote: > Sorry. The V5 version has one place conflicting with another patch. I w= ill make a new one soon. >=20 > Jun Zhu > Citrix Systems UK > ________________________________________ > From: Jun Zhu (Intern) > Sent: 17 September 2010 10:02 > To: Ian Campbell > Cc: Ian Jackson; xen-devel@lists.xensource.com > Subject: RE: [Xen-devel] [PATCH V5] libxl: make libxl communicate with = xenstored by socket or xenbus driver >=20 > This version adds gc as a parameter to libxl__xs_open, and uses LIBXL__= LOG_ERRNO for logging. If some functions cannot use the ctx, It should tr= ansfer NULL to libxl__xs_open to disable logging. (But it will make users= difficult to find the problem when no logging is output.) > To make consistent with other functions in libxl__xshelp.c, I use gc as= its parameter, not ctx. In the libxl_ctx_init function, I add =E2=80=9Cl= ibxl__gc gc =3D LIBXL_INIT_GC(ctx)=E2=80=9D to get the gc of ctx. Please = check this. >=20 > Signed-off-by: Jun Zhu >=20 > diff -r cca905a429aa tools/libxl/libxl.c > --- a/tools/libxl/libxl.c Tue Sep 14 15:39:36 2010 +0100 > +++ b/tools/libxl/libxl.c Fri Sep 17 14:58:50 2010 +0100 > @@ -40,6 +40,8 @@ >=20 > int libxl_ctx_init(libxl_ctx *ctx, int version, xentoollog_logger *lg) > { > + libxl__gc gc =3D LIBXL_INIT_GC(ctx); > + > if (version !=3D LIBXL_VERSION) > return ERROR_VERSION; > memset(ctx, 0, sizeof(libxl_ctx)); > @@ -53,12 +55,8 @@ + libxl__free_all(&gc); > return ERROR_FAIL; > } This leaks memory in success and both failure paths. That to be fixed in next patch too I hope? :)