aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--findutils/grep.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/findutils/grep.c b/findutils/grep.c
index 12cad34aa..04dd2b0e4 100644
--- a/findutils/grep.c
+++ b/findutils/grep.c
@@ -301,6 +301,7 @@ static int file_action_grep(const char *filename, struct stat *statbuf, void* ma
301 } 301 }
302 cur_file = filename; 302 cur_file = filename;
303 *(int*)matched += grep_file(file); 303 *(int*)matched += grep_file(file);
304 fclose(file);
304 return 1; 305 return 1;
305} 306}
306 307
@@ -446,13 +447,13 @@ int grep_main(int argc, char **argv)
446 } 447 }
447 } 448 }
448 matched += grep_file(file); 449 matched += grep_file(file);
450 bb_fclose_nonstdin(file);
449 grep_done: 451 grep_done:
450 if (matched < 0) { 452 if (matched < 0) {
451 /* we found a match but were told to be quiet, stop here and 453 /* we found a match but were told to be quiet, stop here and
452 * return success */ 454 * return success */
453 break; 455 break;
454 } 456 }
455 bb_fclose_nonstdin(file);
456 } 457 }
457 458
458 /* destroy all the elments in the pattern list */ 459 /* destroy all the elments in the pattern list */