From: Jerome St-Louis Date: Sun, 6 Jul 2014 03:45:48 +0000 (-0400) Subject: compiler/libec: Fixed more memory leaks X-Git-Tag: 0.44.10PR1~79 X-Git-Url: https://ecere.com/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e975678b0f6e422d6eb25d48ddf2ef015c71ba5;hp=7c6d1bb8b671095af88a917b927a27634586e253;p=sdk compiler/libec: Fixed more memory leaks --- diff --git a/compiler/bootstrap/libec/bootstrap/pass15.c b/compiler/bootstrap/libec/bootstrap/pass15.c index 00c21c9..b6912e3 100644 --- a/compiler/bootstrap/libec/bootstrap/pass15.c +++ b/compiler/bootstrap/libec/bootstrap/pass15.c @@ -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) diff --git a/compiler/bootstrap/libec/bootstrap/pass16.c b/compiler/bootstrap/libec/bootstrap/pass16.c index 891028c..7877f2f 100644 --- a/compiler/bootstrap/libec/bootstrap/pass16.c +++ b/compiler/bootstrap/libec/bootstrap/pass16.c @@ -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); } } } diff --git a/compiler/libec/src/pass15.ec b/compiler/libec/src/pass15.ec index d01c44d..09b9596 100644 --- a/compiler/libec/src/pass15.ec +++ b/compiler/libec/src/pass15.ec @@ -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); diff --git a/compiler/libec/src/pass16.ec b/compiler/libec/src/pass16.ec index c982786..5922ddd 100644 --- a/compiler/libec/src/pass16.ec +++ b/compiler/libec/src/pass16.ec @@ -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; }