diff options
author | Craig Small <csmall@enc.com.au> | 2014-12-23 08:58:47 +1100 |
---|---|---|
committer | Craig Small <csmall@enc.com.au> | 2014-12-23 08:58:47 +1100 |
commit | 9e870ae6e732c85e565cbd7137dd68d123ef4f06 (patch) | |
tree | 908c3055efd28c3694c56d2ecf973af2a51c28c9 | |
parent | e7203c36a2a4dc10cd8268a5dc036fc9c2a73b6c (diff) |
Removed early free on name_len
name_len was being freed too early and in a loop so
sometimes you would hit a double-free problem
The locale changes were to keep efence happy though
i suspect something strange was going on with locales there
too.
-rw-r--r-- | src/killall.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/killall.c b/src/killall.c index 1b8e878..f861649 100644 --- a/src/killall.c +++ b/src/killall.c @@ -131,8 +131,7 @@ uptime() fprintf(stderr, "killall: error opening uptime file\n"); exit(1); } - savelocale = setlocale(LC_NUMERIC, NULL); - setlocale(LC_NUMERIC,"C"); + savelocale = setlocale(LC_NUMERIC,"C"); if (fscanf(file, "%2047s", buf) == EOF) perror("uptime"); fclose(file); setlocale(LC_NUMERIC,savelocale); @@ -528,7 +527,6 @@ kill_all (int signal, int names, char **namelist, struct passwd *pwent) found_name = j; break; } - free(name_len); if (names && found_name==-1) continue; /* match by process name faild */ @@ -571,6 +569,7 @@ kill_all (int signal, int names, char **namelist, struct passwd *pwent) } free(reglist); free(pgids); + free(name_len); if (!quiet) for (i = 0; i < names; i++) if (!(found & (1 << i))) |