From: Craig Small Date: Thu, 28 Apr 2016 12:16:51 +0000 (+1000) Subject: killall: fix malloc branch logic for pgid X-Git-Tag: v23.0rc1~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ee26f2605a927ed8d74b22b858709c5c35a59088;p=psmisc killall: fix malloc branch logic for pgid A fix to remove some spurious code removed a branch and an else but did not invert the if check like it should. It meant if process groups were used the spaces was not allocated. References: commit 1fcc2b17ab8e88a023d3cd38057e9a5fe93d7313 --- diff --git a/src/killall.c b/src/killall.c index 9f9a74d..5b3315e 100644 --- a/src/killall.c +++ b/src/killall.c @@ -463,7 +463,7 @@ kill_all (int signal, int name_count, char **namelist, struct passwd *pwent) perror ("malloc"); exit (1); } - if (!process_group) + if (process_group) { pgids = calloc (pids, sizeof (pid_t)); if (!pgids) @@ -653,6 +653,7 @@ kill_all (int signal, int name_count, char **namelist, struct passwd *pwent) free(pid_killed); free(pid_table); free(command); + free(name_info); return error; }