compiler/libec: Fixed more memory leaks
authorJerome St-Louis <jerome@ecere.com>
Sun, 6 Jul 2014 03:45:48 +0000 (23:45 -0400)
committerJerome St-Louis <jerome@ecere.com>
Sun, 6 Jul 2014 03:45:48 +0000 (23:45 -0400)
compiler/bootstrap/libec/bootstrap/pass15.c
compiler/bootstrap/libec/bootstrap/pass16.c
compiler/libec/src/pass15.ec
compiler/libec/src/pass16.ec

index 00c21c9..b6912e3 100644 (file)
@@ -15362,6 +15362,7 @@ func = MkClassFunction(MkListOne(MkSpecifier(VOID)), (((void *)0)), MkDeclarator
 ProcessClassFunctionBody(func, propWatch->compound);
 propWatch->compound = (((void *)0));
 createdExternal = ProcessClassFunction(watcherClass, func, ast, curExternal, 1);
+FreeClassFunction(func);
 curExternal = createdExternal;
 ProcessFunction(createdExternal->__anon1.function);
 if(propWatch->deleteWatch)
index 891028c..7877f2f 100644 (file)
@@ -433,6 +433,8 @@ extern struct Specifier * MkStructOrUnion(int type, struct Identifier * id, stru
 
 extern struct Identifier * CopyIdentifier(struct Identifier * id);
 
+extern void FreeIdentifier(struct Identifier * id);
+
 struct Type;
 
 struct __ecereNameSpace__ecere__com__Property
@@ -2694,11 +2696,13 @@ if(nextMember->identifiers && (*nextMember->identifiers).count > 1 && !strcmp(fi
 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*nextMembers->__anon1.dataMembers), nextMember);
 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*nextMember->identifiers), nextID);
 ListAdd(partList, nextMember);
+FreeIdentifier(nextID);
 }
 }
 }
 }
 member->initializer->__anon1.exp = MkExpInstance(MkInstantiation(spec, (((void *)0)), MkListOne(MkMembersInitList(partList))));
+FreeIdentifier(firstID);
 member->identifiers = (((void *)0));
 }
 found = 1;
@@ -3568,6 +3572,7 @@ if(nextMember->identifiers && (*nextMember->identifiers).count > 1 && !strcmp(fi
 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*nextMembers->__anon1.dataMembers), nextMember);
 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*nextMember->identifiers), nextID);
 ListAdd(partList, nextMember);
+FreeIdentifier(nextID);
 }
 }
 }
index d01c44d..09b9596 100644 (file)
@@ -12484,15 +12484,15 @@ static void ProcessStatement(Statement stmt)
 
                   if(object && object.expType && object.expType.kind == classType && object.expType._class && object.expType._class.registered)
                   {
-                     // TESTING THIS STUFF... BEWARE OF SYMBOL ID ISSUES
                      func = MkClassFunction(MkListOne(MkSpecifier(VOID)), null, MkDeclaratorFunction(MkDeclaratorIdentifier(MkIdentifier(watcherName)),
-                        //MkListOne(MkTypeName(MkListOne(MkSpecifier(VOID)), null))), null);
                         MkListOne(MkTypeName(MkListOne(MkSpecifierName(object.expType._class.string)), MkDeclaratorIdentifier(MkIdentifier("value"))))), null);
                      ProcessClassFunctionBody(func, propWatch.compound);
                      propWatch.compound = null;
 
                      createdExternal = ProcessClassFunction(watcherClass, func, ast, curExternal, true);
 
+                     FreeClassFunction(func);
+
                      curExternal = createdExternal;
                      ProcessFunction(createdExternal.function);
 
index c982786..5922ddd 100644 (file)
@@ -1746,6 +1746,7 @@ static bool ProcessBracketInst_DataMember(DataMember parentMember, Instantiation
                                           nextMembers.dataMembers->Remove(nextMember);
                                           nextMember.identifiers->Remove(nextID);
                                           ListAdd(partList, nextMember);
+                                          FreeIdentifier(nextID);
                                        }
                                     }
                                  }
@@ -2057,6 +2058,7 @@ static bool ProcessBracketInst(Instantiation inst, OldList list)
                                              nextMembers.dataMembers->Remove(nextMember);
                                              nextMember.identifiers->Remove(nextID);
                                              ListAdd(partList, nextMember);
+                                             FreeIdentifier(nextID);
                                           }
                                        }
                                     }
@@ -2065,6 +2067,7 @@ static bool ProcessBracketInst(Instantiation inst, OldList list)
                                  member.initializer.exp = MkExpInstance(MkInstantiation(spec, null,
                                     MkListOne(MkMembersInitList(partList))));
 
+                                 FreeIdentifier(firstID);
                                  // TESTING THIS
                                  member.identifiers = null;
                               }