[Mesa-stable] [PATCH] st/mesa: fix sampler view leak in st_DrawAtlasBitmaps()

Charmaine Lee charmainel at vmware.com
Thu Apr 14 21:26:50 UTC 2016


Looks good to me.

Reviewed-by: Charmaine Lee <charmainel at vmware.com>
________________________________________
From: Brian Paul <brianp at vmware.com>
Sent: Thursday, April 14, 2016 2:12 PM
To: mesa-dev at lists.freedesktop.org
Cc: Charmaine Lee; 11.1 11.2
Subject: [PATCH] st/mesa: fix sampler view leak in st_DrawAtlasBitmaps()

I neglected to free the sampler view which was created earlier in the
function.  So for each glCallLists() command that used the bitmap atlas
to draw text, we'd leak a smpler view object.

Also, check for st_create_texture_sampler_view() failure and record
GL_OUT_OF_MEMORY.

Cc: "11.1 11.2" <mesa-stable at lists.freedesktop.org>
---
 src/mesa/state_tracker/st_cb_bitmap.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index 4fd2dfe..b4d04b4 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -704,6 +704,10 @@ st_DrawAtlasBitmaps(struct gl_context *ctx,
    st_validate_state(st, ST_PIPELINE_RENDER);

    sv = st_create_texture_sampler_view(pipe, stObj->pt);
+   if (!sv) {
+      _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCallLists(bitmap text)");
+      return;
+   }

    setup_render_state(ctx, sv, color, true);

@@ -793,6 +797,8 @@ st_DrawAtlasBitmaps(struct gl_context *ctx,

    pipe_resource_reference(&vb.buffer, NULL);

+   pipe_sampler_view_reference(&sv, NULL);
+
    /* We uploaded modified constants, need to invalidate them. */
    st->dirty.mesa |= _NEW_PROGRAM_CONSTANTS;
 }
--
1.9.1



More information about the mesa-stable mailing list