On Wednesday, 2018-08-22 09:58:16 -0700, Caio Marcelo de Oliveira Filho wrote:
> On Wed, Aug 22, 2018 at 12:38:40PM +0100, Eric Engestrom wrote:
> > CovID: 1438469 (RESOURCE_LEAK)
> > Fixes: 606e40b2659ad7fc4ae8e "util: Add utilities to handle shader_test 
> > files"
> > Signed-off-by: Eric Engestrom <eric.engest...@intel.com>
> > ---
> >  tests/util/piglit-shader-test.c | 1 +
> >  1 file changed, 1 insertion(+)
> 
> This patch is
> 
> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.olive...@intel.com>

Thanks; I just pushed the series.

> 
> 
> 
> > diff --git a/tests/util/piglit-shader-test.c 
> > b/tests/util/piglit-shader-test.c
> > index 6aeb5a521a25b2d62301..4802983e56d1037be079 100644
> > --- a/tests/util/piglit-shader-test.c
> > +++ b/tests/util/piglit-shader-test.c
> > @@ -137,6 +137,7 @@ piglit_load_source_from_shader_test(const char 
> > *filename,
> >     if (first_line == NULL) {
> >             fprintf(stderr, "Could not find groupname \"%s\" on file 
> > \"%s\"\n",
> >                     group_name, filename);
> > +           free(text);
> >             return false;
> >     }
> 
> Since you are touching this file, a patch suggestion.  A few lines
> below there is
> 
>       text_size = line - first_line + 1;
>       source = malloc(sizeof(char*) * text_size);
>       snprintf(source, line - first_line + 1, "%s", first_line);
> 
>       if (output_source)
>               *output_source = source;
> 
> There's a leak lurking there (we don't currently hit it, though) in
> case output_source == NULL, source is ignored.  Maybe just move the
> malloc/snprintf to inside the block?

Good catch, making that patch now ;)

> 
> 
> Thanks,
> Caio
_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to