PascalCoin Forum

PascalCoin => Development & Technical Discussion => Topic started by: Skybuck on January 27, 2022, 01:30:09 PM

Title: Potential TList leak in FindLastSameBlockByOperationsBlock in UNetProtocol.pas
Post by: Skybuck on January 27, 2022, 01:30:09 PM
Potential TList leak, plus potential TPCOperationsComp leaks that were added to same TList via Do_GetOperationsBlock.

See *** for problem code.

Line 1587 start of function:

  Function FindLastSameBlockByOperationsBlock(min,max : Cardinal; var OperationBlock : TOperationBlock) : Boolean;
  var i : Integer;
    ant_nblock : Int64;
    auxBlock, sbBlock : TOperationBlock;
    distinctmax,distinctmin : Cardinal;
    BlocksList : TList<TPCOperationsComp>;
    errors : String;
  Begin
    Result := false;
    OperationBlock := CT_OperationBlock_NUL;
    repeat
      BlocksList := TList<TPCOperationsComp>.Create; // *** LIST CREATED ***
      try
        If Not Do_GetOperationsBlock(Nil,min,max,20000,true,BlocksList) then exit; // *** LIST NOT DESTROYED ***