summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-02-27 10:51:50 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-02-27 10:51:50 +0000
commite889d3a709b55a0731ab098b17a3364b9bf39387 (patch)
tree0f84e1d9dbd7af434c5b21a4440816529d33e6b7 /src
parentd21d781466785c317131a8a57606925867265dc8 (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>
Diffstat (limited to 'src')
-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 65c8f39e..88d49bd4 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