Internet Direct (Indy) Version 9.0.1 Beta
FreeAndNil
Frees an object reference and replaces the reference with Nil.

procedure FreeAndNil(var Obj);
Parameters
var Obj
Object reference to be freed and Nil'd.

Description
FreeAndNil is a procedure used to free the object reference specified by Obj, and sets the object reference to the Nil value.

Use FreeAndNil to ensure that a variable is Nil after you free the object it references. Pass any variable that represents an object as the Obj parameter.

Note: Do not pass a value for Obj if it is not an instance of TObject or a TObject descendant.

FreeAndNil is a convenience procedure provided for Delphi or C++ Builder products using a VCL version prior to VCL 5.