summaryrefslogtreecommitdiff
path: root/src/sna
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-06-01 17:20:51 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-06-01 17:30:38 +0100
commit67e8ac365c4b7dd9c4eb2abe46aecc8cc04d4278 (patch)
treea950333b1bf028d80527ba25cd92ec651c43c16f /src/sna
parente91b27ae14a5366175a4fe9c87ee15a0a25b5a42 (diff)
sna/gen3+: Guard against a kgem_bo_destroy(NULL)
Reported-by: Zdenek Kabelac <zkabelac@redhat.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna')
-rw-r--r--src/sna/gen3_render.c3
-rw-r--r--src/sna/gen4_render.c3
-rw-r--r--src/sna/gen5_render.c3
-rw-r--r--src/sna/gen6_render.c3
-rw-r--r--src/sna/gen7_render.c3
5 files changed, 10 insertions, 5 deletions
diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c
index 8cafeb81..d8d1e09e 100644
--- a/src/sna/gen3_render.c
+++ b/src/sna/gen3_render.c
@@ -1651,7 +1651,8 @@ static int gen3_vertex_finish(struct sna *sna)
if (sna->render.vbo)
sna->render.vertices = kgem_bo_map(&sna->kgem, sna->render.vbo);
if (sna->render.vertices == NULL) {
- kgem_bo_destroy(&sna->kgem, sna->render.vbo);
+ if (sna->render.vbo)
+ kgem_bo_destroy(&sna->kgem, sna->render.vbo);
sna->render.vbo = NULL;
return 0;
}
diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c
index 8ab707f0..dd66a462 100644
--- a/src/sna/gen4_render.c
+++ b/src/sna/gen4_render.c
@@ -401,7 +401,8 @@ static int gen4_vertex_finish(struct sna *sna)
if (sna->render.vbo)
sna->render.vertices = kgem_bo_map(&sna->kgem, sna->render.vbo);
if (sna->render.vertices == NULL) {
- kgem_bo_destroy(&sna->kgem, sna->render.vbo);
+ if (sna->render.vbo)
+ kgem_bo_destroy(&sna->kgem, sna->render.vbo);
sna->render.vbo = NULL;
return 0;
}
diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c
index 68c1bb77..9c30041d 100644
--- a/src/sna/gen5_render.c
+++ b/src/sna/gen5_render.c
@@ -393,7 +393,8 @@ static int gen5_vertex_finish(struct sna *sna)
if (sna->render.vbo)
sna->render.vertices = kgem_bo_map(&sna->kgem, sna->render.vbo);
if (sna->render.vertices == NULL) {
- kgem_bo_destroy(&sna->kgem, sna->render.vbo);
+ if (sna->render.vbo)
+ kgem_bo_destroy(&sna->kgem, sna->render.vbo);
sna->render.vbo = NULL;
return 0;
}
diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index d9068de7..df2eeb2e 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -967,7 +967,8 @@ static int gen6_vertex_finish(struct sna *sna)
if (sna->render.vbo)
sna->render.vertices = kgem_bo_map(&sna->kgem, sna->render.vbo);
if (sna->render.vertices == NULL) {
- kgem_bo_destroy(&sna->kgem, sna->render.vbo);
+ if (sna->render.vbo)
+ kgem_bo_destroy(&sna->kgem, sna->render.vbo);
sna->render.vbo = NULL;
return 0;
}
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index 3f314375..6bf25d32 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -1105,7 +1105,8 @@ static int gen7_vertex_finish(struct sna *sna)
if (sna->render.vbo)
sna->render.vertices = kgem_bo_map(&sna->kgem, sna->render.vbo);
if (sna->render.vertices == NULL) {
- kgem_bo_destroy(&sna->kgem, sna->render.vbo);
+ if (sna->render.vbo)
+ kgem_bo_destroy(&sna->kgem, sna->render.vbo);
sna->render.vbo = NULL;
return 0;
}