[Mesa-dev] [PATCH] radv: fix a memleak when compiling the GS copy shader

Eric Engestrom eric.engestrom at imgtec.com
Fri Sep 1 14:44:14 UTC 2017


On Friday, 2017-09-01 15:40:52 +0100, Eric Engestrom wrote:
> On Friday, 2017-09-01 14:07:43 +0200, Samuel Pitoiset wrote:
> > Found by inspection.
> > 
> > Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> > ---
> >  src/amd/vulkan/radv_pipeline.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
> > index f2d1b491b7..858cc54085 100644
> > --- a/src/amd/vulkan/radv_pipeline.c
> > +++ b/src/amd/vulkan/radv_pipeline.c
> > @@ -618,6 +618,9 @@ radv_pipeline_compile(struct radv_pipeline *pipeline,
> >  								  gs_copy_code,
> >  								  gs_copy_code_size);
> >  		}
> > +
> > +		if (gs_copy_code)
> > +			free(gs_copy_code);
> 
> No need for the `if` guard, free(NULL) is a noop.

Sorry, sent too quickly; with the `if` removed, this is:
Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>

> 
> >  	}
> >  	if (!module->nir)
> >  		ralloc_free(nir);
> > -- 
> > 2.14.1
> > 


More information about the mesa-dev mailing list