diff options
author | Alain Magloire <alainm@rcsm.ee.mcgill.ca> | 1998-11-19 00:37:05 +0000 |
---|---|---|
committer | Alain Magloire <alainm@rcsm.ee.mcgill.ca> | 1998-11-19 00:37:05 +0000 |
commit | 50a2576e6775424f9ff8297add9237ab1ab8bceb (patch) | |
tree | 4456df15cf1d72a7565a3117f14820893870ac34 /src | |
parent | 96297aec0ed823a02d8e8ec4d380f4bdd57fa6b9 (diff) | |
download | grep-50a2576e6775424f9ff8297add9237ab1ab8bceb.tar.gz |
Update from Paul, dfainit() was call in search.c and also in dfacomp
remove the search call. grep.c file was freed twice.
Update from Paul, dfainit() was call in search.c and also in dfacomp
remove the search call. grep.c file was freed twice.
* src/grep.c (grepdir): Fix bug: memory freed twice.
* src/search.c (Gcompile, Ecompile): Don't invoke dfainit,
since dfacomp does it for us, and if we also do it then we
leak memory.
Diffstat (limited to 'src')
-rw-r--r-- | src/grep.c | 3 | ||||
-rw-r--r-- | src/search.c | 4 |
2 files changed, 2 insertions, 5 deletions
@@ -837,7 +837,8 @@ grepdir (dir, name_size) status &= grepfile (file); } out_file -= !no_filenames; - free (file); + if (file) + free (file); free (name_space); } diff --git a/src/search.c b/src/search.c index 98315ef6..6d3e9432 100644 --- a/src/search.c +++ b/src/search.c @@ -142,8 +142,6 @@ Gcompile(pattern, size) if ((err = re_compile_pattern(pattern, size, ®ex)) != 0) fatal(err, 0); - dfainit(&dfa); - /* In the match_words and match_lines cases, we use a different pattern for the DFA matcher that will quickly throw out cases that won't work. Then if DFA succeeds we do some hairy stuff using the regex matcher @@ -210,8 +208,6 @@ Ecompile(pattern, size) if ((err = re_compile_pattern(pattern, size, ®ex)) != 0) fatal(err, 0); - dfainit(&dfa); - /* In the match_words and match_lines cases, we use a different pattern for the DFA matcher that will quickly throw out cases that won't work. Then if DFA succeeds we do some hairy stuff using the regex matcher |