pgrep: Fixing memory leak in do_regcomp()

This commit is contained in:
Jaromir Capik 2014-01-02 18:39:27 +01:00
parent 38cbeedeb7
commit 69de8db3e2

View File

@ -460,6 +460,9 @@ static regex_t * do_regcomp (void)
} }
re_err = regcomp (preg, re, REG_EXTENDED | REG_NOSUB | opt_case); re_err = regcomp (preg, re, REG_EXTENDED | REG_NOSUB | opt_case);
if (opt_exact) free(re);
if (re_err) { if (re_err) {
regerror (re_err, preg, errbuf, sizeof(errbuf)); regerror (re_err, preg, errbuf, sizeof(errbuf));
fputs(errbuf,stderr); fputs(errbuf,stderr);