aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/dri2
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-04-15 15:08:38 +0000
committermarha <marha@users.sourceforge.net>2011-04-15 15:08:38 +0000
commit205a4bdae76f287126db9f45a4f0ba631e3efca1 (patch)
tree6327d3e449dfe53ad6ee6125290581aae6f5ed35 /xorg-server/hw/xfree86/dri2
parent898081f31f99dc35a1602a607a07d1aaff49ac40 (diff)
parent71372d36e1a3f0230b88808f70d35446fda12260 (diff)
downloadvcxsrv-205a4bdae76f287126db9f45a4f0ba631e3efca1.tar.gz
vcxsrv-205a4bdae76f287126db9f45a4f0ba631e3efca1.tar.bz2
vcxsrv-205a4bdae76f287126db9f45a4f0ba631e3efca1.zip
svn merge ^/branches/released .
Diffstat (limited to 'xorg-server/hw/xfree86/dri2')
-rw-r--r--xorg-server/hw/xfree86/dri2/dri2.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/xorg-server/hw/xfree86/dri2/dri2.c b/xorg-server/hw/xfree86/dri2/dri2.c
index c754b760f..ae890882b 100644
--- a/xorg-server/hw/xfree86/dri2/dri2.c
+++ b/xorg-server/hw/xfree86/dri2/dri2.c
@@ -358,7 +358,7 @@ allocate_or_reuse_buffer(DrawablePtr pDraw, DRI2ScreenPtr ds,
static void
update_dri2_drawable_buffers(DRI2DrawablePtr pPriv, DrawablePtr pDraw,
- DRI2BufferPtr *buffers, int *out_count, int *width, int *height)
+ DRI2BufferPtr *buffers, int out_count, int *width, int *height)
{
DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
int i;
@@ -374,7 +374,7 @@ update_dri2_drawable_buffers(DRI2DrawablePtr pPriv, DrawablePtr pDraw,
}
pPriv->buffers = buffers;
- pPriv->bufferCount = *out_count;
+ pPriv->bufferCount = out_count;
pPriv->width = pDraw->width;
pPriv->height = pDraw->height;
*width = pPriv->width;
@@ -409,6 +409,8 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height,
&& (pPriv->serialNumber == DRI2DrawableSerial(pDraw));
buffers = calloc((count + 1), sizeof(buffers[0]));
+ if (!buffers)
+ goto err_out;
for (i = 0; i < count; i++) {
const unsigned attachment = *(attachments++);
@@ -475,7 +477,7 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height,
*out_count = i;
- update_dri2_drawable_buffers(pPriv, pDraw, buffers, out_count, width, height);
+ update_dri2_drawable_buffers(pPriv, pDraw, buffers, *out_count, width, height);
/* If the client is getting a fake front-buffer, pre-fill it with the
* contents of the real front-buffer. This ensures correct operation of
@@ -501,15 +503,17 @@ err_out:
*out_count = 0;
- for (i = 0; i < count; i++) {
+ if (buffers) {
+ for (i = 0; i < count; i++) {
if (buffers[i] != NULL)
- (*ds->DestroyBuffer)(pDraw, buffers[i]);
- }
+ (*ds->DestroyBuffer)(pDraw, buffers[i]);
+ }
- free(buffers);
- buffers = NULL;
+ free(buffers);
+ buffers = NULL;
+ }
- update_dri2_drawable_buffers(pPriv, pDraw, buffers, out_count, width, height);
+ update_dri2_drawable_buffers(pPriv, pDraw, buffers, *out_count, width, height);
return buffers;
}