]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
kill: fix issue warned by smatch
authorSami Kerola <kerolasa@iki.fi>
Sat, 10 Sep 2011 14:50:47 +0000 (16:50 +0200)
committerSami Kerola <kerolasa@iki.fi>
Sat, 10 Sep 2011 14:55:27 +0000 (16:55 +0200)
misc-utils/procs.c +82 get_pids(52) error: potential null derefence 'pids'.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
misc-utils/procs.c

index 3f52387de7a4869b6bd9ec23f466260847fac6ad..7bbe02fe11df35f46faa2c00fbe6e9afdfe49817 100644 (file)
@@ -23,6 +23,7 @@
 #include <ctype.h>
 #include <unistd.h>
 #include "kill.h"
+#include "xalloc.h"
 
 extern char *mybasename (char *);
 static char *parse_parens (char *buf);
@@ -77,7 +78,7 @@ get_pids (char *process_name, int get_all) {
        if (strcmp (process_name, mybasename (cp))) continue;
        while (pids_size < num_pids + 2) {
            pids_size += 5;
-           pids = (int *) realloc (pids, sizeof (int) * pids_size);
+           pids = (int *) xrealloc (pids, sizeof (int) * pids_size);
        }
        pids[num_pids++] = pid;
        pids[num_pids] = -1;