WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] add missing libxl__free_all() calls

To: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] add missing libxl__free_all() calls
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date: Mon, 13 Dec 2010 18:14:13 +0000
Cc: Juergen Gross <juergen.gross@xxxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Mon, 13 Dec 2010 10:18:12 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1291903926.20366.19.camel@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <9ada9b410270be89e4e9.1291902672@nehalem1> <1291903926.20366.19.camel@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
On Thu, 9 Dec 2010, Gianni Tedesco wrote:
> On Thu, 2010-12-09 at 13:51 +0000, Juergen Gross wrote:
> > @@ -3760,8 +3772,10 @@ int libxl_destroy_cpupool(libxl_ctx *ctx
> >      libxl_cpumap cpumap;
> >  
> >      info = xc_cpupool_getinfo(ctx->xch, poolid);
> > -    if (info == NULL)
> > -        return ERROR_NOMEM;
> > +    if (info == NULL) {
> > +        libxl__free_all(&gc);
> > +        return ERROR_NOMEM;
> > +    }
> 
> This one is un-necessary but harmless. The INIT_GC macro just zeros the
> structure and allocates nothing. It might not be wise to rely on
> programmer knowing that about the implementation in the long run...
> 

I actually think that is a good idea to always call libxl__free_all
before exiting.
libxl__free_all should guarantee to do the right thing no matter if
something has been allocated or not, so I am going to apply the patch as
is.
Thanks!

Stefano


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

<Prev in Thread] Current Thread [Next in Thread>