summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-02-27 10:51:50 +0000
committerOwain G. Ainsworth <oga@openbsd.org>2011-03-16 20:19:11 +0000
commit21393783fcb228d7d7240dada744a758d8cce945 (patch)
tree10abf7a4c4889dfd361749db57fce9fce9c9cade
parent6cf8a5f721a9334e3bd228eb7c5501153966f930 (diff)
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@codewiz.org> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=34787 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> (cherry picked from commit e889d3a709b55a0731ab098b17a3364b9bf39387) Signed-off-by: Owain G. Ainsworth <oga@openbsd.org>
-rw-r--r--src/intel_dri.c6
1 files 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