pgrep: Remove memory leak

This is part of !118 where @tt.rantala found a memory leak.
The other part of !118 may come later if the performance change
is significant.

References:
 procps-ng/procps!118
This commit is contained in:
Craig Small 2020-12-22 16:14:56 +11:00
parent e7c3c0279f
commit 048820fde3

View File

@ -663,6 +663,11 @@ static struct el * select_procs (int *num)
free(cmdsearch);
free(cmdoutput);
if (preg) {
regfree(preg);
free(preg);
}
*num = matches;
if ((!matches) && (!opt_full) && opt_pattern && (strlen(opt_pattern) > 15))