[PATCH] xserver: Fix double free's in config file parser
Benjamin Herrenschmidt
benh at kernel.crashing.org
Thu Jul 14 17:43:04 PDT 2011
On Thu, 2011-07-14 at 09:26 -0700, Keith Packard wrote:
> On Fri, 15 Jul 2011 01:36:05 +1000, Benjamin Herrenschmidt <benh at kernel.crashing.org> wrote:
> > On Thu, 2011-07-14 at 07:57 -0700, Dan Nicholson wrote:
> > > I also see a couple instances of "free (val.str)" in parser/Files.c
> > > that don't set it to NULL afterward. Yay for custom parsers! With
> > > those two instances fixed:
> >
> > Hrm, did I have a grep failure ? Oh... I see, I didn't catch the space
> > between free and (val.str). I can send a newer patch tomorrow, or an
> > addon, let me know, I'm off to bed now.
>
> Might as well send a single patch which fixes all of them in one go.
>
> I also wouldn't mind seeing a patch to replace 'val' with a slightly
> more appropriate name :-)
Somewhat I knew that's what I was going to end up doing :-)
Will take a bit longer, I'm in the middle of some other more urgent
stuff (unless somebody else wants to pick it up).
I need to look more at how this parser works but it should be possible
to have a more robust handling of the lifetime of that "current token"
anyways.
Something, like freeing it when we try to replace it (or some other
"common" place like at the end of the loops) rather than having each
case that can potentially consume a string have to have the right 2
statements in the right place, that sort of thing...
Might even be possible to stop making it a global I suppose.
Anyway, don't hold your breath on me doing that real soon, I'll fixup
the patch for the immediate bug(s) later today hopefully and will try to
go back to those other improvements later, maybe next week but no
promise.
Cheers,
Ben.
More information about the xorg-devel
mailing list