From: Ian Campbell Subject: Re: [PATCH] xl: free common_domname on exit Date: Wed, 12 Jun 2013 16:17:40 +0100 Message-ID: <1371050260.24512.460.camel@zakaz.uk.xensource.com> References: <1371044154-10763-1-git-send-email-ian.campbell@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: George Dunlap Cc: Ian Jackson , George Dunlap , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Wed, 2013-06-12 at 16:12 +0100, George Dunlap wrote: > > diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c > > index c1a969b..325b257 100644 > > --- a/tools/libxl/xl_cmdimpl.c > > +++ b/tools/libxl/xl_cmdimpl.c > > @@ -68,7 +68,7 @@ libxl_ctx *ctx; > > xlchild children[child_max]; > > > > #define INVALID_DOMID ~0 > > -static const char *common_domname; > > +static char *common_domname = NULL; > > Why is "const" being removed? free takes a non-const void *, so it has to be non-const to free it. I had checked that all the places which assigned here were dynamically allocated and not e.g. string literals but double checking that I missed that the one in create_domain takes it from the c_info without dupping it, which would lead to a double free. There's probably a leak of the original name in there too. With that in mind I nack my own patch ;-) >From what I can tell the right fix is too big for 4.3 so I'll leave this until 4.4. Ian.