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

Re: [Xen-devel] [PATCH] xl: free common_domname on exit



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.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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