[Mesa-dev] [PATCH] r600/sb: Fix memory leak

Bartosz Tomczyk bartosz.tomczyk86 at gmail.com
Sun Jan 29 18:10:25 UTC 2017


---
 src/gallium/drivers/r600/sb/sb_valtable.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/r600/sb/sb_valtable.cpp b/src/gallium/drivers/r600/sb/sb_valtable.cpp
index a8b7b49cd4..d31a1b76d5 100644
--- a/src/gallium/drivers/r600/sb/sb_valtable.cpp
+++ b/src/gallium/drivers/r600/sb/sb_valtable.cpp
@@ -241,6 +241,7 @@ void value::remove_use(const node *n) {
 	{
 		// TODO assert((*it)->kind == kind) ?
 		// TODO assert((*it)->arg == arg) ?
+		delete *it;
 		uses.erase(it);
 	}
 }
@@ -290,7 +291,12 @@ bool value::is_prealloc() {
 }
 
 void value::delete_uses() {
-	uses.erase(uses.begin(), uses.end());
+	for (uselist::iterator it = uses.begin(); it != uses.end(); ++it)
+	{
+		delete *it;
+	}
+
+	uses.clear();
 }
 
 void ra_constraint::update_values() {
-- 
2.11.0



More information about the mesa-dev mailing list