[PATCH] dri2: Fix NULL check in allocation error handling
Kristian Høgsberg
krh at bitplanet.net
Mon May 17 14:40:30 PDT 2010
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 at bitplanet.net>
---
Argh, the previous patch was wrong, I was testing [i - 1] but decided
to just move the increment down. Of course I left an [i - 1] in there...
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 68982fe..29c917f 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;
}
--
1.7.0.1
More information about the xorg-devel
mailing list