aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorRafael Antognolli <[email protected]>2019-02-15 14:16:04 -0800
committerKenneth Graunke <[email protected]>2019-02-21 10:26:12 -0800
commit8190165d135f8c6cfb347a1613a0ceb0bcee7e9e (patch)
tree6cc7066deb38b553ce6e3096c9fdbbdd17f8a7e3 /src/gallium
parent7da53d7188292f03a4e5f52b98c6c1ba6da2783e (diff)
iris: Avoid leaking if we fail to allocate the aux buffer.
Otherwise we could leak the aux state map or the aux BO.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/iris/iris_resource.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c
index 9c7420f2b4c..d305dbf34cf 100644
--- a/src/gallium/drivers/iris/iris_resource.c
+++ b/src/gallium/drivers/iris/iris_resource.c
@@ -362,14 +362,18 @@ iris_resource_alloc_aux(struct iris_screen *screen, struct iris_resource *res)
res->aux.surf.size_B,
IRIS_MEMZONE_OTHER, I915_TILING_Y,
res->aux.surf.row_pitch_B, alloc_flags);
- if (!res->aux.bo)
+ if (!res->aux.bo) {
+ iris_resource_disable_aux(res);
return false;
+ }
/* Optionally, initialize the auxiliary data to the desired value. */
if (memset_value != 0) {
void *map = iris_bo_map(NULL, res->aux.bo, MAP_WRITE | MAP_RAW);
- if (!map)
+ if (!map) {
+ iris_resource_disable_aux(res);
return false;
+ }
memset(map, memset_value, res->aux.surf.size_B);
iris_bo_unmap(res->aux.bo);