[fpc-devel] memleak in fpdoc
Michael Van Canneyt
michael at freepascal.org
Sun Nov 7 12:14:45 CET 2010
On Sat, 6 Nov 2010, Vincent Snijders wrote:
> 2010/11/5 Michael Van Canneyt <michael at freepascal.org>:
>>
>>
>> On Fri, 5 Nov 2010, Vincent Snijders wrote:
>>
>>> Hi,
>>>
>>> I am trying to fix the memleaks in fpdoc. Attached is a patch for
>>> pascal parser package.
>>>
>>> There are still more leaks, but that is for another time.
>
> I debugged some more. In procedure
> ProcessInheritanceStrings(inhInfo:TStringList) the inhclass string
> list is created, but not freed. The trivial patch below fixes that.
> Another problem is the line:
> if not assigned(CreateAliasType(alname,clname,cls,cls2)) then
> The return value of CreateAliasType doesn't seem to be freed/released.
> I don't know how to fix that.
It should be freed, because it is added to the list of declarations:
module.interfacesection.Declarations.Add(Result);
Removing
cl2.addref;
in CreateAliasType should do it.
Michael.
>
> Vincent
>
> Index: utils/fpdoc/dglobals.pp
> ===================================================================
> --- utils/fpdoc/dglobals.pp (revision 16307)
> +++ utils/fpdoc/dglobals.pp (working copy)
> @@ -856,7 +856,8 @@
> cls2:=ResolveAndLinkClass(clname,j=0,cls);
> end;
> end;
> -end;
> + inhclass.free;
> + end;
>
> var
> s, Name: String;
> _______________________________________________
> fpc-devel maillist - fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
>
More information about the fpc-devel
mailing list