]> granicus.if.org Git - procps-ng/commitdiff
pgrep: Fixing memory leak in do_regcomp()
authorJaromir Capik <jcapik@redhat.com>
Thu, 2 Jan 2014 17:39:27 +0000 (18:39 +0100)
committerJaromir Capik <jcapik@redhat.com>
Thu, 2 Jan 2014 17:39:27 +0000 (18:39 +0100)
pgrep.c

diff --git a/pgrep.c b/pgrep.c
index 6290ec5e954982fba688b3c3536178513be4aeca..93a7c893467c762f43cb87b6008f7cd9e48ea859 100644 (file)
--- a/pgrep.c
+++ b/pgrep.c
@@ -460,6 +460,9 @@ static regex_t * do_regcomp (void)
                }
 
                re_err = regcomp (preg, re, REG_EXTENDED | REG_NOSUB | opt_case);
+
+               if (opt_exact) free(re);
+
                if (re_err) {
                        regerror (re_err, preg, errbuf, sizeof(errbuf));
                        fputs(errbuf,stderr);