[Mesa-dev] [PATCH 2/3] r600g/sb: fix memory leaks
Vadim Girlin
vadimgirlin at gmail.com
Sat May 4 19:10:21 PDT 2013
Signed-off-by: Vadim Girlin <vadimgirlin at gmail.com>
---
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(-)
diff --git a/src/gallium/drivers/r600/sb/sb_bc_parser.cpp b/src/gallium/drivers/r600/sb/sb_bc_parser.cpp
index e1478d3..8329287 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 9bda84f..5944ba6 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() {
--
1.8.2.1
More information about the mesa-dev
mailing list