From: Julien Isorce Date: Thu, 23 Mar 2017 13:49:30 +0000 (+0000) Subject: st_cb_bitmap: check NULL return from u_upload_alloc X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=699cce3493364e8647a6fe8b9f7031fe9f645d8e;p=mesa.git st_cb_bitmap: check NULL return from u_upload_alloc Signed-off-by: Julien Isorce Reviewed-by: Brian Paul Reviewed-by: Marek Olšák --- 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);