Memory Leak with GetEncoding

Giganews Newsgroups
Subject: Memory Leak with GetEncoding
Posted by:  Christian Kaufmann (christian.kaufma…
Date: Tue, 13 Jul 2010


I noticed a memory leak with the latest Indy source:

A memory block has been leaked. The size is: 36

This block was allocated by thread 0x990, and the stack trace (return
addresses) at the time was:
404736 [System.pas][System][System.@GetMem][2979]
405BDB [System.pas][System][System.TObject.NewInstance][9433]
4061A6 [System.pas][System][System.@ClassCreate][10277]
4739DA [SysUtils.pas][SysUtils][SysUtils.TMBCSEncoding.Create][22434]
9DE8D0 [IdCharsets.pas][IdCharsets][IdCharsets.FindCharset][3888]
473806 [SysUtils.pas][SysUtils][SysUtils.TEncoding.GetEncoding][22360]

The problem is TEncoding.GetEncoding, which creates a new object, that
has to be freed by the calling method.

Or should I do that, when calling CharsetToEncoding() ?

cu Christian