From: Vinson Lee Date: Sat, 4 Aug 2012 21:04:03 +0000 (-0700) Subject: st/mesa: Fix a potential memory leak in get_mesa_program. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7d65356d8a4d268dce4c933d7704d709e1cdacfa;p=mesa.git st/mesa: Fix a potential memory leak in get_mesa_program. Fixes resource leak defect reported by Coverity. Signed-off-by: Vinson Lee Reviewed-by: José Fonseca --- diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index fcd69b18d3a..66627acb6fc 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -4790,7 +4790,7 @@ get_mesa_program(struct gl_context *ctx, struct gl_shader_program *shader_program, struct gl_shader *shader) { - glsl_to_tgsi_visitor* v = new glsl_to_tgsi_visitor(); + glsl_to_tgsi_visitor* v; struct gl_program *prog; GLenum target; const char *target_string; @@ -4822,6 +4822,7 @@ get_mesa_program(struct gl_context *ctx, if (!prog) return NULL; prog->Parameters = _mesa_new_parameter_list(); + v = new glsl_to_tgsi_visitor(); v->ctx = ctx; v->prog = prog; v->shader_program = shader_program;