[Mesa-dev] [PATCH] st/vega: Fix memory leak in combine_shaders.

Vinson Lee vlee at freedesktop.org
Sat Feb 23 17:16:24 PST 2013


Fixes resource leak defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
 src/gallium/state_trackers/vega/shaders_cache.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/vega/shaders_cache.c b/src/gallium/state_trackers/vega/shaders_cache.c
index eceae54..c1082ca 100644
--- a/src/gallium/state_trackers/vega/shaders_cache.c
+++ b/src/gallium/state_trackers/vega/shaders_cache.c
@@ -225,8 +225,10 @@ combine_shaders(const struct shader_asm_info *shaders[SHADER_STAGES], int num_sh
    ureg_END(ureg);
 
    shader->tokens = ureg_finalize(ureg);
-   if(!shader->tokens)
+   if (!shader->tokens) {
+      ureg_destroy(ureg);
       return NULL;
+   }
 
    p = pipe->create_fs_state(pipe, shader);
 
-- 
1.8.1.3



More information about the mesa-dev mailing list