[Mesa-dev] [PATCH 3/4] st_cb_bitmap: check NULL return from u_upload_alloc
Nicolai Hähnle
nhaehnle at gmail.com
Fri Mar 24 11:16:26 UTC 2017
On 24.03.2017 12:08, Julien Isorce wrote:
> Signed-off-by: Julien Isorce <jisorce at oblong.com>
> ---
> src/mesa/state_tracker/st_cb_bitmap.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
> index b2e2608..3ce190e 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)");
> + return;
> + }
While it isn't strictly required by the spec in case of out-of-memory,
it would be nice to do some cleanup. A goto to after the cso_draw_arrays
call would do the job.
Cheers,
Nicolai
> +
> /* build quads vertex data */
> for (i = 0; i < count; i++) {
> const GLfloat epsilon = 0.0001F;
>
--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
More information about the mesa-dev
mailing list