summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2016-04-14 15:07:53 -0600
committerBrian Paul <brianp@vmware.com>2016-04-14 15:32:18 -0600
commitaed975d5c510135c54252746b44d663d094ecb1e (patch)
tree91f142ed8de31503d342fa27494696d5017691a5 /src/mesa/state_tracker
parenta17911ceb11fbf14b296095a9b5c506295b73d99 (diff)
downloadexternal_mesa3d-aed975d5c510135c54252746b44d663d094ecb1e.zip
external_mesa3d-aed975d5c510135c54252746b44d663d094ecb1e.tar.gz
external_mesa3d-aed975d5c510135c54252746b44d663d094ecb1e.tar.bz2
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 sampler view object. Also, check for st_create_texture_sampler_view() failure and record GL_OUT_OF_MEMORY. Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org> Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c6
1 files changed, 6 insertions, 0 deletions
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;
}