Skip to content
Snippets Groups Projects
Commit d89f1248 authored by Junio C Hamano's avatar Junio C Hamano
Browse files

Merge branch 'ma/regex-no-regfree-after-comp-fail'

We used to call regfree() after regcomp() failed in some codepaths,
which have been corrected.

* ma/regex-no-regfree-after-comp-fail:
  regex: do not call `regfree()` if compilation fails
parents 3f384aaa 17154b15
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -215,7 +215,6 @@ static void regcomp_or_die(regex_t *regex, const char *needle, int cflags)
/* The POSIX.2 people are surely sick */
char errbuf[1024];
regerror(err, regex, errbuf, 1024);
regfree(regex);
die("invalid regex: %s", errbuf);
}
}
Loading
Loading
Loading
Loading
@@ -636,7 +636,6 @@ static void compile_fixed_regexp(struct grep_pat *p, struct grep_opt *opt)
if (err) {
char errbuf[1024];
regerror(err, &p->regexp, errbuf, sizeof(errbuf));
regfree(&p->regexp);
compile_regexp_failed(p, errbuf);
}
}
Loading
Loading
@@ -701,7 +700,6 @@ static void compile_regexp(struct grep_pat *p, struct grep_opt *opt)
if (err) {
char errbuf[1024];
regerror(err, &p->regexp, errbuf, 1024);
regfree(&p->regexp);
compile_regexp_failed(p, errbuf);
}
}
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment