Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2005-02

XMLCfg leaking

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Ales Katona

Try this program with a corrupted xml file(just delte part of a tag or something)
Compile with -ghl and you'll get a few bytes leaked.

program xmltest;
{$mode objfpc}{$H+}
uses
  SysUtils, XMLCfg;
function LoadXML(var axml: TXmlConfig; const filename: string): boolean;
begin
  writeln('Loading');
  axml:=nil;
  result:=true;
  try
    axml:=TXMlConfig.Create(filename); // try to parse the file
  except
    on E: Exception do
      begin
        writeln('Error: '+ E.Message);
        result:=false;
      end;
  end;
  if not result then
    freeandnil(axml);
end;
var xml: TXMLConfig;
begin
  if LoadXML(xml, 'test.xml') then
    writeln('Success');
end.

Reply by email

Unknown author
to Ales Katona
Ales Katona wrote
Try this program with a corrupted xml file(just delte part of a tag or something) Compile with -ghl and you'll get a few bytes leaked.

I believe this is the bug Vincent Snijders was talking about. I will look at it; I need to change the xmlread and xmlwrite units anyway.

Michael.

Show quoted text 36 lines
program xmltest; {$mode objfpc}{$H+} uses SysUtils, XMLCfg; function LoadXML(var axml: TXmlConfig; const filename: string): boolean; begin writeln('Loading'); axml:=nil; result:=true; try axml:=TXMlConfig.Create(filename); // try to parse the file except on E: Exception do begin writeln('Error: '+ E.Message); result:=false; end; end; if not result then freeandnil(axml); end; var xml: TXMLConfig; begin if LoadXML(xml, 'test.xml') then writeln('Success'); end. _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email