Mesa (master): st/egl: Plug pbuffer leaks.
Chia-I Wu
olv at kemper.freedesktop.org
Wed Dec 22 06:22:41 UTC 2010
Module: Mesa
Branch: master
Commit: 18bc427adecd7ecd728adc03ed73bb07878c0e8f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=18bc427adecd7ecd728adc03ed73bb07878c0e8f
Author: Chia-I Wu <olv at lunarg.com>
Date: Wed Dec 22 13:59:58 2010 +0800
st/egl: Plug pbuffer leaks.
Unreference validated resources or remove unnecessary validations.
---
.../state_trackers/egl/common/egl_g3d_api.c | 10 ++--------
1 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
index aeabccf..07ea6dc 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
@@ -403,7 +403,6 @@ egl_g3d_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *dpy,
_EGLConfig *conf, const EGLint *attribs)
{
struct egl_g3d_surface *gsurf;
- struct pipe_resource *ptex = NULL;
gsurf = create_pbuffer_surface(dpy, conf, attribs,
"eglCreatePbufferSurface");
@@ -412,13 +411,6 @@ egl_g3d_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *dpy,
gsurf->client_buffer_type = EGL_NONE;
- if (!gsurf->stfbi->validate(gsurf->stfbi,
- &gsurf->stvis.render_buffer, 1, &ptex)) {
- egl_g3d_destroy_st_framebuffer(gsurf->stfbi);
- FREE(gsurf);
- return NULL;
- }
-
return &gsurf->base;
}
@@ -478,12 +470,14 @@ egl_g3d_create_pbuffer_from_client_buffer(_EGLDriver *drv, _EGLDisplay *dpy,
gsurf->client_buffer_type = buftype;
gsurf->client_buffer = buffer;
+ /* validate now so that it fails if the client buffer is invalid */
if (!gsurf->stfbi->validate(gsurf->stfbi,
&gsurf->stvis.render_buffer, 1, &ptex)) {
egl_g3d_destroy_st_framebuffer(gsurf->stfbi);
FREE(gsurf);
return NULL;
}
+ pipe_resource_reference(&ptex, NULL);
return &gsurf->base;
}
More information about the mesa-commit
mailing list