summaryrefslogtreecommitdiff
path: root/src/drm/cairo-drm-i915-shader.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-02-03 08:53:44 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2010-02-03 09:13:20 +0000
commit597dd24ddcc763281c82790b7677e54dc2db8f92 (patch)
tree51958c832f60be6012b6ffcda087ce59d82e5687 /src/drm/cairo-drm-i915-shader.c
parent913a31494ec4bd000dfa303e362d8273b6857cfe (diff)
downloadcairo-597dd24ddcc763281c82790b7677e54dc2db8f92.tar.gz
drm/i915: Free potential leak of cloned textures.
Diffstat (limited to 'src/drm/cairo-drm-i915-shader.c')
-rw-r--r--src/drm/cairo-drm-i915-shader.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/drm/cairo-drm-i915-shader.c b/src/drm/cairo-drm-i915-shader.c
index 059a205f1..ab61947ad 100644
--- a/src/drm/cairo-drm-i915-shader.c
+++ b/src/drm/cairo-drm-i915-shader.c
@@ -1362,6 +1362,7 @@ i915_shader_acquire_surface (i915_shader_t *shader,
cairo_filter_t filter;
cairo_matrix_t m;
int src_x = 0, src_y = 0;
+ cairo_surface_t *free_me = NULL;
cairo_status_t status;
assert (src->type.fragment == (i915_fragment_shader_t) -1);
@@ -1501,6 +1502,8 @@ i915_shader_acquire_surface (i915_shader_t *shader,
_cairo_surface_release_source_image (surface, image, image_extra);
if (unlikely (status))
return status;
+
+ free_me = &s->intel.drm.base;
}
src->type.fragment = FS_TEXTURE;
@@ -1558,6 +1561,9 @@ i915_shader_acquire_surface (i915_shader_t *shader,
cairo_matrix_init_scale (&m, 1. / surface_width, 1. / surface_height);
cairo_matrix_multiply (&src->base.matrix, &src->base.matrix, &m);
+ if (free_me != NULL)
+ cairo_surface_destroy (free_me);
+
return CAIRO_STATUS_SUCCESS;
}