Exit before object is freed

It is common to create and free objects at the start and end of a procedure. There may be instances where an object is created however an exit statement is called and the object is not freed. eyebol will check and warn where this might happen and help prevent unfreed memory and resources. For example:

  Q:=Tquery.Create;
  ...
  if Cancelled then
    exit;
  ...
  Q.Free;

Should read:

  Q:=Tquery.Create;
  ...
  if Cancelled then begin
    Q.Free;
    exit;
  end;
  ...
  Q.Free;

warning Note that you may receive this warning if you have a custom procedure for freeing objects that eyebol does not recognise (for example: ‘procedure FreeAllItems(var sl:TstringList);’)


< Back to list of hints and warnings