]> granicus.if.org Git - psmisc/commitdiff
killall: fix malloc branch logic for pgid
authorCraig Small <csmall@enc.com.au>
Thu, 28 Apr 2016 12:16:51 +0000 (22:16 +1000)
committerCraig Small <csmall@enc.com.au>
Thu, 28 Apr 2016 12:16:51 +0000 (22:16 +1000)
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

src/killall.c

index 9f9a74d11b4f2c47a904a3ff60274d502dba98cd..5b3315ec80ed47630a54f9172e0b9e46d4393dd7 100644 (file)
@@ -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;
 }