From: Vadim Girlin Date: Sat, 4 May 2013 18:05:43 +0000 (+0400) Subject: r600g/sb: fix memory leaks X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=46dfad8b36dda80982613a9d29b9a7e99db3abfb;p=mesa.git r600g/sb: fix memory leaks Signed-off-by: Vadim Girlin --- 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() {