Re: [RFA/commit] Memory leak in on reading frame register

Joel Brobecker
2015-05-16T00:03:49Z

> > gdb/ChangeLog:
> >
> > * infrun.c (handle_inferior_event_1): Renames handle_inferior_event.
> > (handle_inferior_event): New function.
> >
> > Tested on x86_64-linux. No regression.
>
> Not that this has to be changed here, but I'm wondering why all value
> mark/frees aren't done via cleanups. I can imagine sometimes it's not,
> technically, necessary, and I can imagine there's some history/inertia
> here, but having two ways to do this (using a cleanup or not) leaves
> the reader having to wonder if using a cleanup was errantly skipped.

I guess it depends on whether you think you need the certainty of
the cleanup or not. I think both approaches are valid depending
on the context.

In this case, I asked myself that question, and I didn't see a real
need for it, since my thinking was that, if an exception occurs and
propagates through handle_inferior_event, then chances are it'll
propagate all the way, which would then lead to values being cleaned
up as well. So I went with the current pattern.

But I can change it to a cleanup if people prefer. I don't mind.

--
Joel