TPAdES.GenerateSignature : OK; but TPAdES not freed

Hi

A function that signs a PDF document causes an exception when the variable is freed.

The function looks like

VAR

PAdES: TPAdES;

Begin

PAdES := TPAdES.Create(Nil);
TRY
      PAdES.KeyFilePath := Fichier_Cle;
      PAdES.CertFilePath := Fichier_Cert;
      PAdES.PKCS11Param.isToken := False;
      PAdES.PathToOriginalFile := ExtractFilePath(Temp);

      PAdES.GenerateSignature(Temp, Source);
FINALLY
      PAdes.Free;
END;
END;

The document is signed. However, the execption occurs when PAeds is freed.

I join the log file created by FastMM4 to help you.

Regards

Bagueur_MemoryManager_EventLog_paeds.txt (82,9 Ko)

Hi Olivier,

Thanks. What is the TMS CP version?

Regards,

bernard

Thanks for your answer

The version is : 5.2.1.0

{ PAdES.pas }
{ with RAD Studio 13.1 }
{ Version 1.1.7 }
{ last modified: 23 July 2026 }

Hi Olivier,

I could reproduce the bug. It looks like PAdES is trying to free a resource that has already been freed.

More investigation is needed.

Regards,

bernard

Thanks

The bug was with an RSA object, already freed.

Will issue a revised version of the library shortly (5.2.1.1).

Regards,

bernard

:+1: :+1: