AV when releasing TScHttpWebRequest

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
Samuel
Posts: 29
Joined: Fri 11 Feb 2011 12:36
Location: Brazil

AV when releasing TScHttpWebRequest

Post by Samuel » Thu 17 Jun 2021 16:37

When I run Free on TScHttpWebRequest I get an AV.

Below is the routine I'm using:

Code: Select all

Function Download_File(Const wURL_Address, wLocal_Filename: String; var wError_Message: String): Boolean;
var
   wScHttpWebRequest: TScHttpWebRequest;
   wFileStream: TFileStream;
   wScHttpWebResponse: TScHttpWebResponse;
begin
   Result:=False;
   wError_Message:='';
   if FileExists(wLocal_Filename) then Begin
      If Not DeleteFile(wLocal_FileName) Then Begin
         wError_Message:='Could not delete the file';
         Exit;
      End;   
   End;
   wScHttpWebRequest:=TScHttpWebRequest.Create(wURL_Address);
   Try
      wScHttpWebResponse:=TScHttpWebResponse.Create;
      Try
         wFileStream:=TFileStream.Create(wLocal_Filename, fmCreate);
         Try
            Try
               wScHttpWebRequest.IPVersion:=ivIPBoth;
               wScHttpWebRequest.SSLOptions.IgnoreServerCertificateValidity:=False;
               wScHttpWebRequest.Proxy.Address := zprPROXY;
               wScHttpWebRequest.Proxy.Port    := StrToIntDef(zprPORTA, 8080);
               wScHttpWebRequest.Proxy.Credentials.UserName := zprUSER_PROXY;
               wScHttpWebRequest.Proxy.Credentials.Password := zprPWD_PROXY;
               wScHttpWebResponse:=wScHttpWebRequest.GetResponse;
               wScHttpWebResponse.ReadToStream(wFileStream);
               Result:=True;
            Except
               On E: SysUtils.Exception do
                  wError_Message := E.Message;
            End;
         Finally
            wFileStream.Free;
         End;
      Finally
         wScHttpWebResponse.Free;
      End;
   Finally
      wScHttpWebRequest.Free; //<---AV on this line
   End;
end;
Can anyone identify what is wrong?

I'm using SecureBridge 9.5.1 with Delphi 10.4.2.

Thank you

Dimon
Devart Team
Posts: 2890
Joined: Mon 05 Mar 2007 16:32

Re: AV when releasing TScHttpWebRequest

Post by Dimon » Fri 18 Jun 2021 15:39

Hi Samuel,

We've checked your code and unfortunately, we could not reproduce the issue. We really want to help with solving your problem, however we need to generate the same conditions. In order to reproduce it we need a completed sample with real URL.
Please create and send it to our team using the contact form below:
https://www.devart.com/company/contactform.html

Samuel
Posts: 29
Joined: Fri 11 Feb 2011 12:36
Location: Brazil

Re: AV when releasing TScHttpWebRequest

Post by Samuel » Fri 18 Jun 2021 18:07

Hi Dimon,

When preparing a sample program to send to you I found that the error only occurs if I use FastMM5.

Do I need to make any special settings to use SecureBridge with FastMM5?

YanishevskiyVI
Devart Team
Posts: 7
Joined: Wed 02 Jun 2021 09:30

Re: AV when releasing TScHttpWebRequest

Post by YanishevskiyVI » Tue 22 Jun 2021 13:24

Hi Samuel,

We have reproduced the issue and fixed it. This fix will be included in the next SecureBridge build.

Best regards,
Vitaliy

Post Reply