]> granicus.if.org Git - procps-ng/commitdiff
0019-pidof: Do not memleak pidof_root if multiple -c options.
authorQualys Security Advisory <qsa@qualys.com>
Thu, 1 Jan 1970 00:00:00 +0000 (00:00 +0000)
committerCraig Small <csmall@enc.com.au>
Sat, 23 Jun 2018 11:59:14 +0000 (21:59 +1000)
pidof.c

diff --git a/pidof.c b/pidof.c
index 509bafac83e158fe1d38b087928322469c92ba32..c65aaadb7b20d6c73b2e1b1f45e4f3e61309a752 100644 (file)
--- a/pidof.c
+++ b/pidof.c
@@ -324,6 +324,7 @@ int main (int argc, char **argv)
                case 'c':
                        if (geteuid() == 0) {
                                opt_rootdir_check = 1;
+                safe_free(pidof_root);
                                pidof_root = pid_link(getpid(), "root");
                        }
                        break;