|
|
|
|
|
|
|
|
|
|
xen-devel
Re: [Xen-devel] [PATCH,v2]: xl: don't free string literals
On Wed, 2010-09-08 at 17:46 +0100, Ian Campbell wrote:
> On Wed, 2010-09-08 at 17:31 +0100, Gianni Tedesco wrote:
> > The function init_dm_info() is initialising some strings from literals.
> > This is bad juju because when the destructor is called we cannot know if
> > the string literal was overridden with a strdup()'d value. Therefore
> > strdup values in the initialiser then introduce and use the function
> > libxlu_cfg_replace_string() which free's whatever is set before
> > strdupping the new value on top of it. The rule for the new call should
> > be clear due to const vs. non-const arguments - changing the behaviour
> > of libxlu_cfg_get_string() would cause more complexity than it saves.
> >
> > Signed-off-by: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
>
> About to bail for the day, but I guess this (untested) patch makes sense
> on top of this?
Yes, very much so
> Avoids c_info->name being a string literal as well. Although I wonder if
> maybe domain configurations with no name could just be rejected as
> invalid? Having a whole bunch of domains called "test" doesn't seem
> likely to be what anyone wants...
Yeah, that looks suspect to me too.
Gianni
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|
|
|