mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-03 20:49:35 +01:00
* fixed memleaks when file can't be opened
This commit is contained in:
parent
90ff7a6db8
commit
5ea6f2b824
@ -279,7 +279,6 @@ implementation
|
||||
{ implementation, so doesn't need to be saved/restored (JM) }
|
||||
{ oldexceptblockcounter : integer; }
|
||||
oldstatement_level : integer;
|
||||
prev_name : pstring;
|
||||
{$ifdef USEEXCEPT}
|
||||
{$ifndef Delphi}
|
||||
recoverpos : jmp_buf;
|
||||
@ -295,7 +294,6 @@ implementation
|
||||
|
||||
begin
|
||||
inc(compile_level);
|
||||
prev_name:=stringdup(parser_current_file);
|
||||
parser_current_file:=filename;
|
||||
old_compiled_module:=compiled_module;
|
||||
{ save symtable state }
|
||||
@ -416,8 +414,9 @@ implementation
|
||||
aktasmmode:=initasmmode;
|
||||
aktinterfacetype:=initinterfacetype;
|
||||
|
||||
{ startup scanner, and save in current_module }
|
||||
{ startup scanner and load the first file }
|
||||
current_scanner:=tscannerfile.Create(filename);
|
||||
current_scanner.firstfile;
|
||||
{ macros }
|
||||
default_macros;
|
||||
{ read the first token }
|
||||
@ -514,6 +513,7 @@ implementation
|
||||
akttokenpos:=oldtokenpos;
|
||||
block_type:=old_block_type;
|
||||
current_scanner:=oldcurrent_scanner;
|
||||
parser_current_file:=current_scanner.inputfile.name^;
|
||||
{ restore cg }
|
||||
nextlabelnr:=oldnextlabelnr;
|
||||
parse_only:=oldparse_only;
|
||||
@ -556,7 +556,12 @@ implementation
|
||||
statement_level:=oldstatement_level;
|
||||
aktexceptblock:=0;
|
||||
exceptblockcounter:=0;
|
||||
end
|
||||
else
|
||||
begin
|
||||
parser_current_file:='';
|
||||
end;
|
||||
|
||||
{ Shut down things when the last file is compiled }
|
||||
if (compile_level=1) then
|
||||
begin
|
||||
@ -613,8 +618,6 @@ implementation
|
||||
end;
|
||||
|
||||
dec(compile_level);
|
||||
parser_current_file:=prev_name^;
|
||||
stringdispose(prev_name);
|
||||
compiled_module:=old_compiled_module;
|
||||
{$ifdef USEEXCEPT}
|
||||
if longjump_used then
|
||||
@ -625,7 +628,10 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.29 2002-04-20 21:32:24 carl
|
||||
Revision 1.30 2002-04-21 18:57:23 peter
|
||||
* fixed memleaks when file can't be opened
|
||||
|
||||
Revision 1.29 2002/04/20 21:32:24 carl
|
||||
+ generic FPC_CHECKPOINTER
|
||||
+ first parameter offset in stack now portable
|
||||
* rename some constants
|
||||
|
||||
@ -272,6 +272,7 @@ implementation
|
||||
(target_info.target=target_i386_go32v2) then
|
||||
begin
|
||||
consume(token);
|
||||
pt.free;
|
||||
pt:=expr;
|
||||
if is_constintnode(pt) then
|
||||
begin
|
||||
@ -290,6 +291,7 @@ implementation
|
||||
end
|
||||
else
|
||||
Message(parser_e_absolute_only_to_var_or_const);
|
||||
pt.free;
|
||||
symdone:=true;
|
||||
end;
|
||||
{ Handling of Delphi typed const = initialized vars ! }
|
||||
@ -575,7 +577,10 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.22 2001-11-20 18:48:26 peter
|
||||
Revision 1.23 2002-04-21 18:57:24 peter
|
||||
* fixed memleaks when file can't be opened
|
||||
|
||||
Revision 1.22 2001/11/20 18:48:26 peter
|
||||
* fixed initialized variables
|
||||
|
||||
Revision 1.21 2001/10/23 21:49:42 peter
|
||||
|
||||
@ -113,6 +113,7 @@ interface
|
||||
procedure tempcloseinputfile;
|
||||
procedure saveinputfile;
|
||||
procedure restoreinputfile;
|
||||
procedure firstfile;
|
||||
procedure nextfile;
|
||||
procedure addfile(hp:tinputfile);
|
||||
procedure reload;
|
||||
@ -913,9 +914,14 @@ implementation
|
||||
invalid:=false;
|
||||
in_asm_string:=false;
|
||||
macros:=tdictionary.create;
|
||||
end;
|
||||
|
||||
|
||||
procedure tscannerfile.firstfile;
|
||||
begin
|
||||
{ load block }
|
||||
if not openinputfile then
|
||||
Message1(scan_f_cannot_open_input,fn);
|
||||
Message1(scan_f_cannot_open_input,inputfile.name^);
|
||||
reload;
|
||||
{ process first read char }
|
||||
case c of
|
||||
@ -2758,7 +2764,10 @@ exit_label:
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.35 2002-04-21 15:22:26 carl
|
||||
Revision 1.36 2002-04-21 18:57:23 peter
|
||||
* fixed memleaks when file can't be opened
|
||||
|
||||
Revision 1.35 2002/04/21 15:22:26 carl
|
||||
* first check .inc file extension
|
||||
|
||||
Revision 1.34 2002/04/21 07:24:09 carl
|
||||
|
||||
Loading…
Reference in New Issue
Block a user