From a250406b41a8ba977c037f4b18fa9290f5b35f2f Mon Sep 17 00:00:00 2001 From: Martin Ruckert Date: Mon, 27 Nov 2023 11:16:42 +0000 Subject: HINT: free filename stack entries if NOT NULL git-svn-id: svn://tug.org/texlive/trunk@68979 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/hitexdir/hitex.w | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'Build') diff --git a/Build/source/texk/web2c/hitexdir/hitex.w b/Build/source/texk/web2c/hitexdir/hitex.w index f0401d2c4c6..fdf33697b69 100644 --- a/Build/source/texk/web2c/hitexdir/hitex.w +++ b/Build/source/texk/web2c/hitexdir/hitex.w @@ -7527,6 +7527,10 @@ is finished: {@+first=start;line=line_stack[index]; if ((name==18)||(name==19)) pseudo_close();else if (name > 17) a_close(&cur_file); /*forget it*/ +if (full_source_filename_stack[in_open]!=NULL) +{ free(full_source_filename_stack[in_open]); + full_source_filename_stack[in_open]=NULL; +} pop_input;decr(in_open); } @@ -10996,10 +11000,10 @@ loop@+{@+begin_file_reading(); /*set up |cur_file| and new level of input*/ prompt_file_name("input file name",".tex"); } done: name=a_make_name_string(&cur_file);@/ -if (source_filename_stack[in_open]==NULL) +if (source_filename_stack[in_open]!=NULL) free(source_filename_stack[in_open]); source_filename_stack[in_open]=strdup((char *)name_of_file+1); /*\TeX\ Live*/ -if (full_source_filename_stack[in_open]==NULL) +if (full_source_filename_stack[in_open]!=NULL) free(full_source_filename_stack[in_open]); full_source_filename_stack[in_open]=strdup(full_name_of_file); if (job_name==0) @@ -34886,6 +34890,10 @@ static char *find_file(char *fname, kpse_file_format_type t, int mx) fname++; } filename = kpse_find_file(fname, t, mx); + if (full_name_of_file!=NULL) + { free(full_name_of_file); full_name_of_file=NULL;} + if (filename!=NULL) + full_name_of_file=strdup(filename); if (quoted) { /* Undo modifications */ fname--; @@ -34948,7 +34956,8 @@ static int texmf_yesno(const char *var) } @ We need a stack, matching the |line_stack| that -contains the source file names; +contains the source file names. For the full source filenames we use +poiters to |char| because these names are just used for output. @= static char * @!source_filename_stack0[max_in_open]={NULL}, **const @!source_filename_stack = @!source_filename_stack0-1; -- cgit v1.2.3