Back

LL085

Memory leak in except handler

Object Pascal — Delphi & Free Pascal
Warning
Reliability

Objects created before try/except without cleanup in the except block leak on exception

objects created before try/except without cleanup in the except block leak on exception.

Why this severity

objects created before try/except without cleanup in the except block leak on exception.


Known false positives

try blocks that also have a finally clause handling the cleanup.

Remediation example

Obj := TMyObject.Create;
try
  Obj.Process;
finally
  Obj.Free; // use try/finally instead of try/except
end;

Reconnecting… Connection lost. Reload