[Mesa-dev] [PATCH v2 3/4] st_cb_bitmap: check NULL return from u_upload_alloc
Brian Paul
brianp at vmware.com
Mon Mar 27 14:41:29 UTC 2017
On 03/27/2017 07:46 AM, Julien Isorce wrote:
> Signed-off-by: Julien Isorce <jisorce at oblong.com>
> ---
> 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 b2e2608..cf820e4 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);
>
Reviewed-by: Brian Paul <brianp at vmware.com>
More information about the mesa-dev
mailing list