charmxi: plug another memory leak in the AST nodes for chare classes
authorPhil Miller <mille121@illinois.edu>
Tue, 21 Feb 2012 08:20:24 +0000 (02:20 -0600)
committerPhil Miller <mille121@illinois.edu>
Tue, 21 Feb 2012 08:20:24 +0000 (02:20 -0600)
src/xlat-i/xi-symbol.C
src/xlat-i/xi-symbol.h

index 4304ce907fa7fefd333cf81e4c4b6313b65aa4b1..fb4184b81418844ec296cb2acb51ba2a41c4d1bf 100644 (file)
@@ -862,7 +862,7 @@ Chare::Chare(int ln, attrib_t Nattr, NamedType *t, TypeList *b, MemberList *l)
                }
        }
        if (bases==NULL) //Always add Chare as a base class
-               bases = new TypeList(new NamedType("Chare"), bases);
+               bases = new TypeList(new NamedType("Chare"), NULL);
 }
 
 void
@@ -1166,6 +1166,7 @@ Group::Group(int ln, attrib_t Nattr,
        hasSection=1;
        bases_CBase=NULL;
        if (b==NULL) {//Add Group as a base class
+               delete bases;
                if (isNodeGroup())
                        bases = new TypeList(new NamedType("NodeGroup"), NULL);
                else {
@@ -1351,6 +1352,7 @@ Array::Array(int ln, attrib_t Nattr, NamedType *index,
        else indexType<<"CkArrayIndex";
 
        if(b==0) { //No other base class:
+               delete bases;
                if (0==strcmp(type->getBaseName(),"ArrayElement"))
                        //ArrayElement has special "ArrayBase" superclass
                        bases = new TypeList(new NamedType("ArrayBase"), NULL);
index b06bc003ba0e477f2452a30d55014e716730ee28..76b74234d7420dfec8db28df8af9bfdae7d565ff 100644 (file)
@@ -237,6 +237,7 @@ class TypeList : public Printable {
     TypeList *next;
   public:
     TypeList(Type *t, TypeList *n=0) : type(t), next(n) {}
+    ~TypeList() { delete type; delete next; }
     int length(void) const;
     Type *getFirst(void) {return type;}
     void print(XStr& str);