summaryrefslogtreecommitdiff
path: root/src/sna/sna_gradient.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-06-02 08:23:35 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-06-02 08:24:19 +0100
commite51f984a4c15de42c5bee3aeacee553e2dd4eca0 (patch)
treecb7f00dd85dc780e3b15d82515bd1fd993a1785d /src/sna/sna_gradient.c
parent2c5647a18e7856b604bce70270463fc128c2cfcd (diff)
sna: Check gradient allocations during init
Reported-by: Zdenek Kabelac <zkabelac@redhat.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_gradient.c')
-rw-r--r--src/sna/sna_gradient.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/sna/sna_gradient.c b/src/sna/sna_gradient.c
index a52cfb51..0fda6ce3 100644
--- a/src/sna/sna_gradient.c
+++ b/src/sna/sna_gradient.c
@@ -336,10 +336,12 @@ static Bool sna_alpha_cache_init(struct sna *sna)
cache->cache_bo,
sizeof(uint32_t)*i,
sizeof(uint32_t));
+ if (cache->bo[i] == NULL)
+ return FALSE;
+
cache->bo[i]->pitch = 4;
}
- kgem_bo_write(&sna->kgem, cache->cache_bo, color, sizeof(color));
- return TRUE;
+ return kgem_bo_write(&sna->kgem, cache->cache_bo, color, sizeof(color));
}
static Bool sna_solid_cache_init(struct sna *sna)
@@ -360,6 +362,9 @@ static Bool sna_solid_cache_init(struct sna *sna)
cache->color[0] = 0xffffffff;
cache->bo[0] = kgem_create_proxy(&sna->kgem, cache->cache_bo,
0, sizeof(uint32_t));
+ if (cache->bo[0] == NULL)
+ return FALSE;
+
cache->bo[0]->pitch = 4;
cache->dirty = 1;
cache->size = 1;