xf86-video-intel: src/intel_dri.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Jun 30 05:59:08 PDT 2010


 src/intel_dri.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 772f8236d50725f0b330508616b4f2a9a910662a
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jun 30 13:58:05 2010 +0100

    dri: Handle errors during GetBuffers() gracefully.
    
    Unwind the array of Pixmaps already allocated and report failure for the
    old dri GetBuffers() path.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/intel_dri.c b/src/intel_dri.c
index e876ab2..198d5d4 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -147,12 +147,21 @@ I830DRI2CreateBuffers(DrawablePtr drawable, unsigned int *attachments,
 		privates[i].attachment = attachments[i];
 
 		bo = intel_get_pixmap_bo(pixmap);
-		if (bo != NULL && dri_bo_flink(bo, &buffers[i].name) != 0) {
+		if (bo == NULL || dri_bo_flink(bo, &buffers[i].name) != 0) {
 			/* failed to name buffer */
+			screen->DestroyPixmap(pixmap);
+			goto unwind;
 		}
 	}
 
 	return buffers;
+
+unwind:
+	while (i--)
+		screen->DestroyPixmap(privates[i].pixmap);
+	free(privates);
+	free(buffers);
+	return NULL;
 }
 
 static void


More information about the xorg-commit mailing list