From f3c2916e1ac6b3c1f949074e49b9b8dbbcb36937 Mon Sep 17 00:00:00 2001 From: Cary R Date: Wed, 10 Dec 2008 18:16:17 -0800 Subject: [PATCH] Make a copy of the local include directory so that it doesn't get lost. Some compilers when optimizing can overwrite the path before it is read so make a copy of the local include directory and free it when we are done. --- ivlpp/lexor.lex | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ivlpp/lexor.lex b/ivlpp/lexor.lex index d0a086e2e..58f0f9c82 100644 --- a/ivlpp/lexor.lex +++ b/ivlpp/lexor.lex @@ -1463,12 +1463,7 @@ static void do_include() else { *cp = '\0'; - - /* We do not need a strdup here since the path is read before - * it is overridden. If the search order is changed add a - * strdup here and a free below. - */ - include_dir[0] = path; + include_dir[0] = strdup(path); } for (idx = start ; idx < include_cnt ; idx += 1) @@ -1491,6 +1486,7 @@ static void do_include() code_that_switches_buffers: /* Clear the current files path from the search list. */ + free(include_dir[0]); include_dir[0] = 0; if(depend_file)