From 21393783fcb228d7d7240dada744a758d8cce945 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 27 Feb 2011 10:51:50 +0000 Subject: 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 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=34787 Signed-off-by: Chris Wilson (cherry picked from commit e889d3a709b55a0731ab098b17a3364b9bf39387) Signed-off-by: Owain G. Ainsworth --- src/intel_dri.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/intel_dri.c b/src/intel_dri.c index ff8f0aaf..e4504e4c 100644 --- a/src/intel_dri.c +++ b/src/intel_dri.c @@ -397,17 +397,17 @@ I830DRI2DestroyBuffers(DrawablePtr drawable, DRI2BufferPtr buffers, int count) 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 -- cgit v1.2.3