]> git.cworth.org Git - apitrace/blobdiff - trace_model.cpp
Don't leak all over the place.
[apitrace] / trace_model.cpp
index 403c78ea0382c38d08fe5fdb4caef20fcfb0cb08..4ac8a35078158a78e1d022c5cf7270c756c9bfdf 100644 (file)
 namespace Trace {
 
 
+Call::~Call() {
+    for (unsigned i = 0; i < args.size(); ++i) {
+        delete args[i];
+    }
+
+    if (ret) {
+        delete ret;
+    }
+}
+
+
+Struct::~Struct() {
+    for (std::vector<Value *>::iterator it = members.begin(); it != members.end(); ++it) {
+        delete *it;
+    }
+}
+
+
+Array::~Array() {
+    for (std::vector<Value *>::iterator it = values.begin(); it != values.end(); ++it) {
+        delete *it;
+    }
+}
+
+
 void Null::visit(Visitor &visitor) { visitor.visit(this); }
 void Bool::visit(Visitor &visitor) { visitor.visit(this); } 
 void SInt::visit(Visitor &visitor) { visitor.visit(this); } 
@@ -44,6 +69,7 @@ void Array::visit(Visitor &visitor) { visitor.visit(this); }
 void Blob::visit(Visitor &visitor) { visitor.visit(this); } 
 void Pointer::visit(Visitor &visitor) { visitor.visit(this); }
 
+
 class Dumper : public Visitor
 {
 protected:
@@ -102,7 +128,7 @@ public:
     }
 
     void visit(Enum *node) {
-        os << literal << node->name << normal;
+        os << literal << node->sig->first << normal;
     }
 
     void visit(Bitmask *bitmask) {
@@ -194,7 +220,7 @@ std::ostream & operator <<(std::ostream &os, Value *value) {
 static inline const Value *unwrap(const Value *node) {
     const Enum *c = dynamic_cast<const Enum *>(node);
     if (c)
-        return c->value;
+        return c->sig->second;
     return node;
 }