Well, if you really want to, you could try putting it either in a try..finally block(but only if you need to free those things in any case, which I doubt). OR you could put the freeing in a seperate procedure, and do it like this:
try
...
GetMem(p, 10000);
Object.SomeProcedure();
OtherObject.Procedure(10, 10);
open:= OpenSomething();
if open = FALSE then FreeProcedure;
...
except
FreeProcedure;
end;
FreeProcedure;
begin
FreeMem(p);
Object.Free;
OtherObject.Free;
CloseSomething();
end;
But there might be other ways....
Bookmarks