From 46dfad8b36dda80982613a9d29b9a7e99db3abfb Mon Sep 17 00:00:00 2001 From: Vadim Girlin Date: Sat, 4 May 2013 22:05:43 +0400 Subject: r600g/sb: fix memory leaks Signed-off-by: Vadim Girlin --- src/gallium/drivers/r600/sb/sb_bc_parser.cpp | 3 ++- src/gallium/drivers/r600/sb/sb_shader.cpp | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/r600/sb/sb_bc_parser.cpp b/src/gallium/drivers/r600/sb/sb_bc_parser.cpp index e1478d380dd..83292874d6b 100644 --- a/src/gallium/drivers/r600/sb/sb_bc_parser.cpp +++ b/src/gallium/drivers/r600/sb/sb_bc_parser.cpp @@ -74,6 +74,8 @@ int bc_parser::parse() { sh = new shader(ctx, t, bc->debug_id, enable_dump); int r = parse_shader(); + delete dec; + if (r) return r; @@ -94,7 +96,6 @@ int bc_parser::parse() { prepare_ir(); - delete dec; return r; } diff --git a/src/gallium/drivers/r600/sb/sb_shader.cpp b/src/gallium/drivers/r600/sb/sb_shader.cpp index 9bda84f32c4..5944ba66f48 100644 --- a/src/gallium/drivers/r600/sb/sb_shader.cpp +++ b/src/gallium/drivers/r600/sb/sb_shader.cpp @@ -355,6 +355,11 @@ shader::~shader() { for (node_vec::iterator I = all_nodes.begin(), E = all_nodes.end(); I != E; ++I) (*I)->~node(); + + for (gpr_array_vec::iterator I = gpr_arrays.begin(), E = gpr_arrays.end(); + I != E; ++I) { + delete *I; + } } void shader::dump_ir() { -- cgit v1.2.3