[Mesa-dev] [PATCH 1/1] Avoid leaking parameter name in prog_to_nir.
Jason Ekstrand
jason at jlekstrand.net
Mon Feb 25 09:20:25 UTC 2019
This is correct. However, it's probably better to just replace most of
that code with a call to nir_variable_create which will do everything in
that block except set the data.read_only bit including the strdup
(properly) and adding it to the list.
--Jason
On Mon, Feb 25, 2019 at 3:06 AM Tapani Pälli <tapani.palli at intel.com> wrote:
> Yep, confirmed that this plugs the leak.
>
> FWIW there seems to be also "Conditional jump or move depends on
> uninitialised value(s)" from valgrind but that is for something different.
>
> Reviewed-by: Tapani Pälli <tapani.palli at intel.com>
>
> On 2/21/19 11:09 AM, Matthias Lorenz wrote:
> > Fixes: 3d7611e9 "st/nir: use NIR for asm programs"
> > ---
> > src/mesa/program/prog_to_nir.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/mesa/program/prog_to_nir.c
> b/src/mesa/program/prog_to_nir.c
> > index 312b299361e..6e3fa9432a3 100644
> > --- a/src/mesa/program/prog_to_nir.c
> > +++ b/src/mesa/program/prog_to_nir.c
> > @@ -1024,7 +1024,8 @@ prog_to_nir(const struct gl_program *prog,
> > c->parameters = rzalloc(s, nir_variable);
> > c->parameters->type =
> > glsl_array_type(glsl_vec4_type(),
> prog->Parameters->NumParameters, 0);
> > - c->parameters->name =
> strdup(prog->Parameters->Parameters[0].Name);
> > + c->parameters->name =
> > + ralloc_strdup(c->parameters,
> prog->Parameters->Parameters[0].Name);
> > c->parameters->data.read_only = true;
> > c->parameters->data.mode = nir_var_uniform;
> > exec_list_push_tail(&s->uniforms, &c->parameters->node);
> > --
> > 2.20.1
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> >
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20190225/5fb5d010/attachment.html>
More information about the mesa-dev
mailing list