[Mesa-dev] [PATCH mesa] util/ra: fix memory leak

Eric Engestrom eric.engestrom at imgtec.com
Mon Jul 31 13:01:12 UTC 2017


On Monday, 2017-07-31 12:07:37 +0200, Nicolai Hähnle wrote:
> On 30.07.2017 00:53, Eric Engestrom wrote:
> > CID: 1415909
> > Fixes: 7a34a0e8903249c41fae "ra: Add a callback for selecting a register
> >                               from what's available."
> > Signed-off-by: Eric Engestrom <eric at engestrom.ch>
> > ---
> >   src/util/register_allocate.c | 1 +
> >   1 file changed, 1 insertion(+)
> > 
> > diff --git a/src/util/register_allocate.c b/src/util/register_allocate.c
> > index b06a61f24a..f6475b6b93 100644
> > --- a/src/util/register_allocate.c
> > +++ b/src/util/register_allocate.c
> > @@ -638,6 +638,7 @@ ra_select(struct ra_graph *g)
> >            }
> >            r = g->select_reg_callback(g, select_regs, g->select_reg_callback_data);
> > +         free(select_regs);
> 
> I don't think this is correct, as the whole thing executes in a loop.

Oops, I misread that as an `if`...

> Please put this at the end of the function (no guard necessary).

Yup, that unnecessary `= NULL` suddenly makes sense :)

Cheers, v2 coming in a minute.


More information about the mesa-dev mailing list