diff --git a/grep.c b/grep.c index d03d9e24c2..4336113442 100644 --- a/grep.c +++ b/grep.c @@ -289,7 +289,7 @@ static struct grep_expr *prep_header_patterns(struct grep_opt *opt) if (!opt->header_list) return NULL; - p = opt->header_list; + for (p = opt->header_list; p; p = p->next) { if (p->token != GREP_PATTERN_HEAD) die("bug: a non-header pattern in grep header list.");