From 699cce3493364e8647a6fe8b9f7031fe9f645d8e Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Thu, 23 Mar 2017 13:49:30 +0000 Subject: st_cb_bitmap: check NULL return from u_upload_alloc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julien Isorce Reviewed-by: Brian Paul Reviewed-by: Marek Olšák --- src/mesa/state_tracker/st_cb_bitmap.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') 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); -- cgit v1.2.3