xf86-video-intel: src/intel_dri.c

Chris Wilson ickle at kemper.freedesktop.org
Sun Feb 27 02:53:41 PST 2011


 src/intel_dri.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit e889d3a709b55a0731ab098b17a3364b9bf39387
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Feb 27 10:51:50 2011 +0000

    dri: Protect against destroying a foreign DRI drawable
    
    I have no clue as to how such an alien drawable reached us, but we have
    the evidence of a segfault to say it can happen.
    
    Reported-by: Bernie Innocenti <bernie at codewiz.org>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=34787
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/intel_dri.c b/src/intel_dri.c
index 65c8f39..88d49bd 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -383,17 +383,17 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int attachment,
 
 static void I830DRI2DestroyBuffer(DrawablePtr drawable, DRI2Buffer2Ptr buffer)
 {
-	if (buffer) {
+	if (buffer && buffer->driverPrivate) {
 		I830DRI2BufferPrivatePtr private = buffer->driverPrivate;
 		if (--private->refcnt == 0) {
 			ScreenPtr screen = private->pixmap->drawable.pScreen;
-
 			screen->DestroyPixmap(private->pixmap);
 
 			free(private);
 			free(buffer);
 		}
-	}
+	} else
+		free(buffer);
 }
 
 #endif


More information about the xorg-commit mailing list