[PATCH weston 2/2] main: don't leak option strings

Pekka Paalanen ppaalanen at gmail.com
Wed Sep 10 00:37:45 PDT 2014


On Tue, 09 Sep 2014 12:18:24 -0700
Bill Spitzak <spitzak at gmail.com> wrote:

> On 09/08/2014 11:49 PM, Pekka Paalanen wrote:
> 
> > parse_options() already strdups() all strings it returns, which is
> > one reason why I would not go removing the strdups.
> 
> You are right it already does that. Did not realize it even though I 
> worked some on that code. I figured it was doing pointer copying.
> 
> The main problem is that if you execute "p = strdup(string)" twice,
> the old value of p will be leaked anyway, unless you add even more
> code to free the old version. I guess this should be fixed in
> parse_options and the the config file parser, though it is an example
> of how plugging these leaks is a nearly endless task.

Yup. And yes, fixing bugs is an endless task.


Thanks,
pq


More information about the wayland-devel mailing list