From af8f7c43140db6fb5966e293cb03c1e90a9c956b Mon Sep 17 00:00:00 2001
From: Roberto Raggi <roberto.raggi@nokia.com>
Date: Thu, 25 Nov 2010 09:41:08 +0100
Subject: [PATCH] Dispose the memory allocated for the demangled id.

---
 src/libs/glsl/glslastdump.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/libs/glsl/glslastdump.cpp b/src/libs/glsl/glslastdump.cpp
index b22ac1bead1..337e120ed81 100644
--- a/src/libs/glsl/glslastdump.cpp
+++ b/src/libs/glsl/glslastdump.cpp
@@ -51,9 +51,13 @@ bool ASTDump::preVisit(AST *ast)
 {
     const char *id = typeid(*ast).name();
 #ifdef Q_CC_GNU
-    id = abi::__cxa_demangle(id, 0, 0, 0);
+    char *cppId = abi::__cxa_demangle(id, 0, 0, 0);
+    id = cppId;
 #endif
     out << QByteArray(_depth, ' ') << id << endl;
+#ifdef Q_CC_GNU
+    free(cppId);
+#endif
     ++_depth;
     return true;
 }
-- 
GitLab