summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorJulien Isorce <jisorce@oblong.com>2017-03-23 13:49:30 +0000
committerJulien Isorce <jisorce@oblong.com>2017-03-28 18:27:55 +0100
commit699cce3493364e8647a6fe8b9f7031fe9f645d8e (patch)
treef698986508f6457218e2cff7dc43afb3faa90545 /src/mesa
parent4a5e779b5f9d169fd043ffaead1525040af816f3 (diff)
st_cb_bitmap: check NULL return from u_upload_alloc
Signed-off-by: Julien Isorce <jisorce@oblong.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Diffstat (limited to 'src/mesa')
-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 b2e2608bc5b..cf820e42147 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -720,6 +720,11 @@ st_DrawAtlasBitmaps(struct gl_context *ctx,
u_upload_alloc(pipe->stream_uploader, 0, num_vert_bytes, 4,
&vb.buffer_offset, &vb.buffer, (void **) &verts);
+ if (unlikely(!verts)) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCallLists(bitmap text)");
+ goto out;
+ }
+
/* build quads vertex data */
for (i = 0; i < count; i++) {
const GLfloat epsilon = 0.0001F;
@@ -797,6 +802,7 @@ st_DrawAtlasBitmaps(struct gl_context *ctx,
cso_draw_arrays(st->cso_context, PIPE_PRIM_QUADS, 0, num_verts);
+out:
restore_render_state(ctx);
pipe_resource_reference(&vb.buffer, NULL);