st_cb_bitmap: check NULL return from u_upload_alloc
authorJulien Isorce <jisorce@oblong.com>
Thu, 23 Mar 2017 13:49:30 +0000 (13:49 +0000)
committerJulien Isorce <jisorce@oblong.com>
Tue, 28 Mar 2017 17:27:55 +0000 (18:27 +0100)
Signed-off-by: Julien Isorce <jisorce@oblong.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/state_tracker/st_cb_bitmap.c

index b2e2608bc5b708970d60654669f72431fa326ba3..cf820e421478c9eb61f3b7ede3300119a954ac16 100644 (file)
@@ -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);