diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2010-05-17 17:40:30 -0400 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-05-17 18:16:26 -0700 |
commit | cba9942f7716b12c329616a9994c5bce857617fa (patch) | |
tree | c465885dabddb24701bc1bec98af96cd091a7d1c /hw/xfree86/dri2/dri2.c | |
parent | 27cec0a0501369a68031c048e691bda4c7095f72 (diff) |
dri2: Fix NULL check in allocation error handling
1461b31e40a3e44f6327199d23cf2ab70d8f5176 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>
Diffstat (limited to 'hw/xfree86/dri2/dri2.c')
-rw-r--r-- | hw/xfree86/dri2/dri2.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index 68982fe3e..29c917f21 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -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; } |