#1 2022-06-29 11:52:26

tbo
Member
Registered: 2015-04-20
Posts: 353

Access violation with function FillZero()

Delphi 11.1, mORMot 3506

The description of the FillZero function is as follows:

/// fill all sensitive fields of this class or record with zeros
// - RawByteString/TBytes with refcount=1 will be zeroed before freed
procedure FillZero(Info: PRttiInfo; var Value); overload;

So the following source code should work:

type
  TLicenseData = record
    CustomerNum: Integer;
    CustomerName: RawUtf8;
    CustomerAddress: RawUtf8;
    LicenceDate: TDate;
    ProductName: RawUtf8;
  end;
  
var
  licData: TLicenseData;
begin
  FillZero(TypeInfo(TLicenseData), licData);

But I get the following error message:

ExceptionMessage="Access violation at address 007CE36C. Read of address 00000000"
FileName="...\mORMot2\src\core\mormot.core.rtti.pas"
LineNumber=6082

With best regards
Thomas

Offline

#2 2022-06-30 16:53:57

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,657
Website

Re: Access violation with function FillZero()

Offline

Board footer

Powered by FluxBB