dri2: Fix NULL check in allocation error handling

1461b31e40 tests to see if the allocation
of buffer[i] failed after i has been incremented, causing it to look
at the wrong pointer.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Tested-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Kristian Høgsberg 2010-05-17 17:40:30 -04:00 committed by Keith Packard
parent 27cec0a050
commit cba9942f77

View File

@ -421,22 +421,24 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height,
if (need_real_front > 0) {
if (allocate_or_reuse_buffer(pDraw, ds, pPriv, DRI2BufferFrontLeft,
front_format, dimensions_match,
&buffers[i++]))
&buffers[i]))
buffers_changed = 1;
if (buffers[i] == NULL)
goto err_out;
i++;
}
if (need_fake_front > 0) {
if (allocate_or_reuse_buffer(pDraw, ds, pPriv, DRI2BufferFakeFrontLeft,
front_format, dimensions_match,
&buffers[i++]))
&buffers[i]))
buffers_changed = 1;
if (buffers[i] == NULL)
goto err_out;
i++;
have_fake_front = 1;
}