Mesa (master): svga: fix memory leak in svga_clear_texture()
Brian Paul
brianp at kemper.freedesktop.org
Thu Nov 3 20:31:02 UTC 2016
Module: Mesa
Branch: master
Commit: 9a9627a791194a35ffd3573fbfa008cba0511a68
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9a9627a791194a35ffd3573fbfa008cba0511a68
Author: Neha Bhende <bhenden at vmware.com>
Date: Fri Oct 28 11:29:11 2016 -0700
svga: fix memory leak in svga_clear_texture()
Piglit tests which uses arb_clear_texture extension, have memory leak issue.
pipe_surface created in svga_clear_texture() was not deleted which happens to be
the cause for memory leak.
tested all arb_clear_texture-* piglit tests with valgrid.
Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Charmaine Lee <charmainel at vmware.com>
---
src/gallium/drivers/svga/svga_pipe_clear.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/svga/svga_pipe_clear.c b/src/gallium/drivers/svga/svga_pipe_clear.c
index 803afc6..56db713 100644
--- a/src/gallium/drivers/svga/svga_pipe_clear.c
+++ b/src/gallium/drivers/svga/svga_pipe_clear.c
@@ -323,8 +323,10 @@ svga_clear_texture(struct pipe_context *pipe,
struct pipe_surface *dsv =
svga_validate_surface_view(svga, svga_surface_dst);
- if (!dsv)
+ if (!dsv) {
+ pipe_surface_reference(&surface, NULL);
return;
+ }
if (box->x == 0 && box->y == 0 && box->width == surface->width &&
box->height == surface->height) {
@@ -382,8 +384,10 @@ svga_clear_texture(struct pipe_context *pipe,
struct pipe_surface *rtv =
svga_validate_surface_view(svga, svga_surface_dst);
- if (!rtv)
+ if (!rtv) {
+ pipe_surface_reference(&surface, NULL);
return;
+ }
if (box->x == 0 && box->y == 0 && box->width == surface->width &&
box->height == surface->height) {
@@ -449,6 +453,7 @@ svga_clear_texture(struct pipe_context *pipe,
}
}
}
+ pipe_surface_reference(&surface, NULL);
}
/**
More information about the mesa-commit
mailing list