[Mesa-dev] [PATCH 1/3] softpipe: fix memory leaks

Morgan Armand morgan.devel at gmail.com
Mon Nov 7 10:37:48 PST 2011


This series of patches is a splitted version of my previous one, as suggested by Brian.

---
 src/gallium/drivers/softpipe/sp_state_derived.c |    5 ++++-
 src/gallium/drivers/softpipe/sp_state_shader.c  |    3 +++
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c
index fd68808..f89d23c 100644
--- a/src/gallium/drivers/softpipe/sp_state_derived.c
+++ b/src/gallium/drivers/softpipe/sp_state_derived.c
@@ -295,9 +295,12 @@ update_polygon_stipple_pattern(struct softpipe_context *softpipe)
    tex = util_pstipple_create_stipple_texture(&softpipe->pipe,
                                               softpipe->poly_stipple.stipple);
    pipe_resource_reference(&softpipe->pstipple.texture, tex);
+   pipe_resource_reference(&tex, NULL);

-   view = util_pstipple_create_sampler_view(&softpipe->pipe, tex);
+   view = util_pstipple_create_sampler_view(&softpipe->pipe,
+                                            softpipe->pstipple.texture);
    pipe_sampler_view_reference(&softpipe->pstipple.sampler_view, view);
+   pipe_sampler_view_reference(&view, NULL);
 }


diff --git a/src/gallium/drivers/softpipe/sp_state_shader.c b/src/gallium/drivers/softpipe/sp_state_shader.c
index 3dd1f9e..612dcb3 100644
--- a/src/gallium/drivers/softpipe/sp_state_shader.c
+++ b/src/gallium/drivers/softpipe/sp_state_shader.c
@@ -207,6 +207,7 @@ softpipe_delete_fs_state(struct pipe_context *pipe, void *fs)
    draw_delete_fragment_shader(softpipe->draw, state->draw_shader);

    FREE((void *) state->shader.tokens);
+   FREE(state);
 }


@@ -335,6 +336,8 @@ softpipe_delete_gs_state(struct pipe_context *pipe, void *gs)

    draw_delete_geometry_shader(softpipe->draw,
                                (state) ? state->draw_data : 0);
+
+   FREE((void *) state->shader.tokens);
    FREE(state);
 }

-- 
1.7.7.1.msysgit.0



More information about the mesa-dev mailing list