summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-02-21 11:42:31 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-02-21 11:48:04 +0000
commitd051793b9194060f5408503b1fac56958c6e58e4 (patch)
tree161d8a05cc929fc30aef1a3c4217ec33fa7019b1
parent580ae520cad749fb86a1bddd0fa2bcadfd60abb6 (diff)
sna/dri: Improve error handling of failing to create a DRI2 pixmap
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_dri.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index 96324e65..58a3e3c3 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -210,7 +210,6 @@ sna_dri_create_buffer(DrawablePtr drawable,
switch (attachment) {
case DRI2BufferFrontLeft:
pixmap = get_drawable_pixmap(drawable);
- pixmap->refcnt++;
bo = sna_pixmap_set_dri(sna, pixmap);
bpp = pixmap->drawable.bitsPerPixel;
DBG(("%s: attaching to front buffer %dx%d [%p:%d]\n",
@@ -295,14 +294,13 @@ sna_dri_create_buffer(DrawablePtr drawable,
private->bo = bo;
if (buffer->name == 0) {
- /* failed to name buffer */
- if (pixmap)
- pixmap->drawable.pScreen->DestroyPixmap(pixmap);
- else
- kgem_bo_destroy(&sna->kgem, bo);
+ kgem_bo_destroy(&sna->kgem, bo);
goto err;
}
+ if (pixmap)
+ pixmap->refcnt++;
+
return buffer;
err:
@@ -531,6 +529,8 @@ sna_dri_copy_region(DrawablePtr draw,
region->extents.x1, region->extents.y1,
region->extents.x2, region->extents.y2,
REGION_NUM_RECTS(region)));
+ assert(dst != NULL);
+ assert(src != NULL);
sna_dri_copy(to_sna_from_drawable(draw), draw, region, dst, src, false);
}