HTMViewer Memory Leak



Hi,

the HTML viewer provided now for free by www.pbear.com for viewing of HTML documents seems to have a memory leak in the image reading code (at least in the current version 9.44).

Images are passed to the component by means of an event handler for the OnImageRequest event:

TGetImageEvent = procedure(Sender: TObject; const SRC: string;
var Stream: TMemoryStream) of Object;

The image data are passed via the TMemoryStream. The var parameter indicates that the stream has to be created by the event handler.

The source code of GetTheBitmap method where this event handler is called, however, shows that this stream is never freed. FastMM, correspondingly, complains about a memory leak.

I could resolve this problem by adding the line

if Assigned(Stream) then Stream.Free;

at the end of the "if Assigned(GetImage) then" section of the TSectionList.GetTheBitmap method (in line 6715 of Htmlsubs.pas, version 9.44, to be precise).

Hope this is useful to somebody...
.