[Mesa-dev] [PATCH] st/mesa: release EGLImage on EGLImageTarget* error

Lucas Stach l.stach at pengutronix.de
Tue Jul 4 09:07:20 UTC 2017


Am Montag, den 03.07.2017, 17:18 +0200 schrieb Marek Olšák:
> Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Thanks, pushed.

> On Fri, Jun 30, 2017 at 11:03 AM, Philipp Zabel <p.zabel at pengutronix.de> wrote:
> > The smapi->get_egl_image() call in st_egl_image_get_surface() stores a
> > reference to the EGLImage's texture in stimg.texture. That reference is
> > released via pipe_resource_reference(&stimg.texture, NULL) before stimg
> > goes out of scope at the end of the function, but not in the error path
> > if !is_format_supported().
> >
> > Fixes: 83e9de25f325 ("st/mesa: EGLImageTarget* error handling")
> > Signed-off-by: Philipp Zabel <p.zabel at pengutronix.de>
> > ---
> >  src/mesa/state_tracker/st_cb_eglimage.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/src/mesa/state_tracker/st_cb_eglimage.c b/src/mesa/state_tracker/st_cb_eglimage.c
> > index 0f649f4ab4..4b7b85db70 100644
> > --- a/src/mesa/state_tracker/st_cb_eglimage.c
> > +++ b/src/mesa/state_tracker/st_cb_eglimage.c
> > @@ -96,6 +96,7 @@ st_egl_image_get_surface(struct gl_context *ctx, GLeglImageOES image_handle,
> >
> >     if (!is_format_supported(screen, stimg.format, stimg.texture->nr_samples, usage)) {
> >        /* unable to specify a texture object using the specified EGL image */
> > +      pipe_resource_reference(&stimg.texture, NULL);
> >        _mesa_error(ctx, GL_INVALID_OPERATION, "%s(format not supported)", error);
> >        return NULL;
> >     }
> > --
> > 2.11.0
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 




More information about the mesa-dev mailing list