[igt-dev] [PATCH i-g-t 2/5] lib/aux: Plug memory leak in get_suspend_test

Chris Wilson chris at chris-wilson.co.uk
Thu Mar 7 12:10:37 UTC 2019


Quoting Chris Wilson (2019-03-07 12:09:26)
> Quoting Petri Latvala (2019-03-07 11:24:24)
> > Free test_line in all paths out of the function.
> > 
> > Signed-off-by: Petri Latvala <petri.latvala at intel.com>
> > ---
> >  lib/igt_aux.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/lib/igt_aux.c b/lib/igt_aux.c
> > index e5d41e32..f4939bb5 100644
> > --- a/lib/igt_aux.c
> > +++ b/lib/igt_aux.c
> > @@ -718,6 +718,8 @@ static enum igt_suspend_test get_suspend_test(int power_dir)
> >                         break;
> >                 }
> >  
> > +       free(test_line);
> > +
> >         if (!test_name)
> >                 return SUSPEND_TEST_NONE;
> >  
> > @@ -727,8 +729,6 @@ static enum igt_suspend_test get_suspend_test(int power_dir)
> >  
> >         igt_assert(test < SUSPEND_TEST_NUM);
> >  
> > -       free(test_line);
> > -
> 
> Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>

Scratch that, test_name points into test_line and is used in the second
loop.
-Chris


More information about the igt-dev mailing list